1 package Module::Install::Base;
9 # Suspend handler for "redefined" warnings
11 my $w = $SIG{__WARN__};
12 $SIG{__WARN__} = sub { $w };
19 Module::Install::Base - Base class for Module::Install extensions
23 In a B<Module::Install> extension:
25 use Module::Install::Base ();
26 @ISA = qw(Module::Install::Base);
30 This module provide essential methods for all B<Module::Install>
31 extensions, in particular the common constructor C<new> and method
32 dispatcher C<AUTOLOAD>.
40 Constructor -- need to preserve at least _top
46 unless ( defined &{"${class}::call"} ) {
47 *{"${class}::call"} = sub { shift->_top->call(@_) };
49 unless ( defined &{"${class}::load"} ) {
50 *{"${class}::load"} = sub { shift->_top->load(@_) };
59 The main dispatcher - copy extensions if missing
65 my $func = eval { shift->_top->autoload } or return;
73 Returns the top-level B<Module::Install> object.
85 Returns the C<_top> object's associated B<Module::Install::Admin> object
86 on the first run (i.e. when there was no F<inc/> when the program
87 started); on subsequent (user-side) runs, returns a fake admin object
88 with an empty C<AUTOLOAD> method that does nothing at all.
95 Module::Install::Base::FakeAdmin->new;
102 Tells whether this is the first run of the installer (on
103 author's side). That is when there was no F<inc/> at
104 program start. True if that's the case. False, otherwise.
109 $_[0]->admin->VERSION;
114 package Module::Install::Base::FakeAdmin;
119 $fake ||= bless(\@_, $_[0]);
126 # Restore warning handler
128 $SIG{__WARN__} = $SIG{__WARN__}->();
143 Audrey Tang E<lt>autrijus@autrijus.orgE<gt>
147 Copyright 2003, 2004 by Audrey Tang E<lt>autrijus@autrijus.orgE<gt>.
149 This program is free software; you can redistribute it and/or modify it
150 under the same terms as Perl itself.
152 See L<http://www.perl.com/perl/misc/Artistic.html>