Skip to content

Instantly share code, notes, and snippets.

@yappo
Created May 18, 2009 06:54
Show Gist options
  • Select an option

  • Save yappo/113354 to your computer and use it in GitHub Desktop.

Select an option

Save yappo/113354 to your computer and use it in GitHub Desktop.
# code base is the.pm # ingy++
use utf8; package うんこな;
sub import {
my $package = caller;
*{"${package}::$_"} = sub { return wantarray ? @_ : $_[0] }
for qw(a an teh the more);
my ($class, $module) = @_;
if ($module) {
eval "require $module";
die $@ if $@;
splice @_, 0, 1;
my $import = $module->can('import')
or return;
goto &$import;
}
}
sub unimport {
my $package = caller;
*{"${package}::$_"} = sub { return wantarray ? @_ : $_[0] }
for qw(a an teh the more);
my ($class, $module) = @_;
if ($module) {
eval "require $module";
die $@ if $@;
splice @_, 0, 1;
my $unimport = $module->can('unimport')
or return;
goto &$unimport;
}
}
1;
__END__
example:
use utf8;
use うんこな Acme::Oppai;
print Acme::Oppai->Oppai->Oppai->Oppai;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment