Image-Info-1.22.tar.gz
[Image-Info.git] / inc / Module / Install / Base.pm
blobf2d791ad57b295d9f097c6eed169c07ae7fd1dfa
1 #line 1
2 package Module::Install::Base;
4 $VERSION = '0.63';
6 # Suspend handler for "redefined" warnings
7 BEGIN {
8 my $w = $SIG{__WARN__};
9 $SIG{__WARN__} = sub { $w };
12 ### This is the ONLY module that shouldn't have strict on
13 # use strict;
15 #line 41
17 sub new {
18 my ($class, %args) = @_;
20 foreach my $method ( qw(call load) ) {
21 *{"$class\::$method"} = sub {
22 shift()->_top->$method(@_);
23 } unless defined &{"$class\::$method"};
26 bless( \%args, $class );
29 #line 61
31 sub AUTOLOAD {
32 my $self = shift;
33 local $@;
34 my $autoload = eval { $self->_top->autoload } or return;
35 goto &$autoload;
38 #line 76
40 sub _top { $_[0]->{_top} }
42 #line 89
44 sub admin {
45 $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
48 sub is_admin {
49 $_[0]->admin->VERSION;
52 sub DESTROY {}
54 package Module::Install::Base::FakeAdmin;
56 my $Fake;
57 sub new { $Fake ||= bless(\@_, $_[0]) }
59 sub AUTOLOAD {}
61 sub DESTROY {}
63 # Restore warning handler
64 BEGIN {
65 $SIG{__WARN__} = $SIG{__WARN__}->();
70 #line 138