diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-19 20:33:36 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-05-19 20:33:36 -0500 |
commit | a886df7e0b15eb32b0fcd73375bd7b4ee2b392cd (patch) | |
tree | 6959e99b8c0206b23d05b3eddd1429ef7edbbaa4 /inc/Module/Install/Base.pm | |
download | language-teco-a886df7e0b15eb32b0fcd73375bd7b4ee2b392cd.tar.gz language-teco-a886df7e0b15eb32b0fcd73375bd7b4ee2b392cd.zip |
Initial import of Language::TECO
Diffstat (limited to 'inc/Module/Install/Base.pm')
-rw-r--r-- | inc/Module/Install/Base.pm | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm new file mode 100644 index 0000000..fd0f81a --- /dev/null +++ b/inc/Module/Install/Base.pm @@ -0,0 +1,70 @@ +#line 1 +package Module::Install::Base; + +$VERSION = '0.73'; + +# Suspend handler for "redefined" warnings +BEGIN { + my $w = $SIG{__WARN__}; + $SIG{__WARN__} = sub { $w }; +} + +### This is the ONLY module that shouldn't have strict on +# use strict; + +#line 41 + +sub new { + my ($class, %args) = @_; + + foreach my $method ( qw(call load) ) { + *{"$class\::$method"} = sub { + shift()->_top->$method(@_); + } unless defined &{"$class\::$method"}; + } + + bless( \%args, $class ); +} + +#line 61 + +sub AUTOLOAD { + my $self = shift; + local $@; + my $autoload = eval { $self->_top->autoload } or return; + goto &$autoload; +} + +#line 76 + +sub _top { $_[0]->{_top} } + +#line 89 + +sub admin { + $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; +} + +sub is_admin { + $_[0]->admin->VERSION; +} + +sub DESTROY {} + +package Module::Install::Base::FakeAdmin; + +my $Fake; +sub new { $Fake ||= bless(\@_, $_[0]) } + +sub AUTOLOAD {} + +sub DESTROY {} + +# Restore warning handler +BEGIN { + $SIG{__WARN__} = $SIG{__WARN__}->(); +} + +1; + +#line 138 |