line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::Base; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
90490
|
use strict 'vars'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
167
|
|
4
|
4
|
|
|
4
|
|
14
|
use vars qw{$VERSION}; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
179
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
4
|
|
|
4
|
|
128
|
$VERSION = '1.18'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Suspend handler for "redefined" warnings |
10
|
|
|
|
|
|
|
BEGIN { |
11
|
4
|
|
|
4
|
|
16
|
my $w = $SIG{__WARN__}; |
12
|
4
|
|
|
|
|
956
|
$SIG{__WARN__} = sub { $w }; |
|
4
|
|
|
|
|
91
|
|
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 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 |
31
|
|
|
|
|
|
|
extensions, in particular the common constructor C and method |
32
|
|
|
|
|
|
|
dispatcher C. |
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
|
653
|
my $class = shift; |
46
|
1
|
50
|
|
|
|
2
|
unless ( defined &{"${class}::call"} ) { |
|
1
|
|
|
|
|
8
|
|
47
|
1
|
|
|
0
|
|
4
|
*{"${class}::call"} = sub { shift->_top->call(@_) }; |
|
1
|
|
|
|
|
3
|
|
|
0
|
|
|
|
|
0
|
|
48
|
|
|
|
|
|
|
} |
49
|
1
|
50
|
|
|
|
2
|
unless ( defined &{"${class}::load"} ) { |
|
1
|
|
|
|
|
5
|
|
50
|
1
|
|
|
0
|
|
3
|
*{"${class}::load"} = sub { shift->_top->load(@_) }; |
|
1
|
|
|
|
|
3
|
|
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
} |
52
|
1
|
|
|
|
|
16
|
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 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 object |
86
|
|
|
|
|
|
|
on the first run (i.e. when there was no F when the program |
87
|
|
|
|
|
|
|
started); on subsequent (user-side) runs, returns a fake admin object |
88
|
|
|
|
|
|
|
with an empty C 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 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
|
|
16
|
use vars qw{$VERSION}; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
132
|
|
117
|
|
|
|
|
|
|
BEGIN { |
118
|
4
|
|
|
4
|
|
232
|
$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
|
|
13
|
$SIG{__WARN__} = $SIG{__WARN__}->(); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=pod |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHORS |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Audrey Tang Eautrijus@autrijus.orgE |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Copyright 2003, 2004 by Audrey Tang Eautrijus@autrijus.orgE. |
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 |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |