source: perl/modules/Jabber/inc/Module/Install/Base.pm @ 925faae

barnowl_perlaimdebianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 925faae was 300b470, checked in by Nelson Elhage <nelhage@mit.edu>, 18 years ago
Adding a Module::Install plugin for building barnowl plugins. It needs a lot of improvement.
  • Property mode set to 100644
File size: 1.0 KB
Line 
1#line 1
2package Module::Install::Base;
3
4$VERSION = '0.65';
5
6# Suspend handler for "redefined" warnings
7BEGIN {
8        my $w = $SIG{__WARN__};
9        $SIG{__WARN__} = sub { $w };
10}
11
12### This is the ONLY module that shouldn't have strict on
13# use strict;
14
15#line 41
16
17sub new {
18    my ($class, %args) = @_;
19
20    foreach my $method ( qw(call load) ) {
21        *{"$class\::$method"} = sub {
22            shift()->_top->$method(@_);
23        } unless defined &{"$class\::$method"};
24    }
25
26    bless( \%args, $class );
27}
28
29#line 61
30
31sub AUTOLOAD {
32    my $self = shift;
33    local $@;
34    my $autoload = eval { $self->_top->autoload } or return;
35    goto &$autoload;
36}
37
38#line 76
39
40sub _top { $_[0]->{_top} }
41
42#line 89
43
44sub admin {
45    $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
46}
47
48sub is_admin {
49    $_[0]->admin->VERSION;
50}
51
52sub DESTROY {}
53
54package Module::Install::Base::FakeAdmin;
55
56my $Fake;
57sub new { $Fake ||= bless(\@_, $_[0]) }
58
59sub AUTOLOAD {}
60
61sub DESTROY {}
62
63# Restore warning handler
64BEGIN {
65        $SIG{__WARN__} = $SIG{__WARN__}->();
66}
67
681;
69
70#line 138
Note: See TracBrowser for help on using the repository browser.