line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::Base; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
135294
|
use strict 'vars'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
206
|
|
4
|
4
|
|
|
4
|
|
30
|
use vars qw{$VERSION}; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
219
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
4
|
|
|
4
|
|
191
|
$VERSION = '1.21'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Suspend handler for "redefined" warnings |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
4
|
|
|
4
|
|
26
|
my $w = $SIG{__WARN__}; |
12
|
4
|
|
|
|
|
1581
|
$SIG{__WARN__} = sub { $w }; |
|
4
|
|
|
|
|
155
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=pod |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Module::Install::Base - Base class for Module::Install extensions |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
In a B<Module::Install> extension: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Module::Install::Base (); |
26
|
|
|
|
|
|
|
@ISA = qw(Module::Install::Base); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
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>. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over 4 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item new(%args) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Constructor -- need to preserve at least _top |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
45
|
1
|
|
|
1
|
1
|
1225
|
my $class = shift; |
46
|
1
|
50
|
|
|
|
3
|
unless ( defined &{"${class}::call"} ) { |
|
1
|
|
|
|
|
11
|
|
47
|
1
|
|
|
0
|
|
5
|
*{"${class}::call"} = sub { shift->_top->call(@_) }; |
|
1
|
|
|
|
|
7
|
|
|
0
|
|
|
|
|
0
|
|
48
|
|
|
|
|
|
|
} |
49
|
1
|
50
|
|
|
|
3
|
unless ( defined &{"${class}::load"} ) { |
|
1
|
|
|
|
|
7
|
|
50
|
1
|
|
|
0
|
|
4
|
*{"${class}::load"} = sub { shift->_top->load(@_) }; |
|
1
|
|
|
|
|
5
|
|
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
} |
52
|
1
|
|
|
|
|
5
|
bless { @_ }, $class; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item AUTOLOAD |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The main dispatcher - copy extensions if missing |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub AUTOLOAD { |
64
|
0
|
|
|
0
|
|
|
local $@; |
65
|
0
|
0
|
|
|
|
|
my $func = eval { shift->_top->autoload } or return; |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
goto &$func; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item _top() |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Returns the top-level B<Module::Install> object. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _top { |
78
|
0
|
|
|
0
|
|
|
$_[0]->{_top}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item admin() |
84
|
|
|
|
|
|
|
|
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. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub admin { |
93
|
|
|
|
|
|
|
$_[0]->_top->{admin} |
94
|
|
|
|
|
|
|
or |
95
|
0
|
0
|
|
0
|
1
|
|
Module::Install::Base::FakeAdmin->new; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=pod |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item is_admin() |
101
|
|
|
|
|
|
|
|
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. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub is_admin { |
109
|
0
|
|
|
0
|
1
|
|
! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
0
|
|
|
sub DESTROY {} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
package Module::Install::Base::FakeAdmin; |
115
|
|
|
|
|
|
|
|
116
|
4
|
|
|
4
|
|
38
|
use vars qw{$VERSION}; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
240
|
|
117
|
|
|
|
|
|
|
BEGIN { |
118
|
4
|
|
|
4
|
|
396
|
$VERSION = $Module::Install::Base::VERSION; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $fake; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub new { |
124
|
0
|
|
0
|
0
|
|
|
$fake ||= bless(\@_, $_[0]); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
0
|
|
|
sub AUTOLOAD {} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
0
|
|
|
sub DESTROY {} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# Restore warning handler |
132
|
|
|
|
|
|
|
BEGIN { |
133
|
4
|
|
|
4
|
|
26
|
$SIG{__WARN__} = $SIG{__WARN__}->(); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L<Module::Install> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHORS |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Audrey Tang E<lt>autrijus@autrijus.orgE<gt> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Copyright 2003, 2004 by Audrey Tang E<lt>autrijus@autrijus.orgE<gt>. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
155
|
|
|
|
|
|
|
under the same terms as Perl itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
See L<http://www.perl.com/perl/misc/Artistic.html> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |