line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package Module::Install::Catalyst; |
3
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
58
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @ISA; |
7
|
|
|
|
|
|
|
require Module::Install::Base; |
8
|
|
|
|
|
|
|
@ISA = qw/Module::Install::Base/; |
9
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
82
|
|
10
|
1
|
|
|
1
|
|
4
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
2834
|
use FindBin; |
|
1
|
|
|
|
|
12490
|
|
|
1
|
|
|
|
|
111
|
|
12
|
1
|
|
|
1
|
|
12
|
use File::Copy::Recursive 'rcopy'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
995
|
|
13
|
|
|
|
|
|
|
use File::Spec (); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $SAFETY = 0; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @IGNORE = |
18
|
|
|
|
|
|
|
qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README |
19
|
|
|
|
|
|
|
_build blib lib script t inc/; |
20
|
|
|
|
|
|
|
our @CLASSES = (); |
21
|
|
|
|
|
|
|
our $ENGINE = 'CGI'; |
22
|
|
|
|
|
|
|
our $CORE = 0; |
23
|
|
|
|
|
|
|
our $MULTIARCH = 0; |
24
|
|
|
|
|
|
|
our $SCRIPT; |
25
|
|
|
|
|
|
|
our $USAGE; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#line 42 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub catalyst { |
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
print <<EOF; |
32
|
|
|
|
|
|
|
*** Module::Install::Catalyst |
33
|
|
|
|
|
|
|
EOF |
34
|
|
|
|
|
|
|
$self->catalyst_files; |
35
|
|
|
|
|
|
|
$self->catalyst_par; |
36
|
|
|
|
|
|
|
print <<EOF; |
37
|
|
|
|
|
|
|
*** Module::Install::Catalyst finished. |
38
|
|
|
|
|
|
|
EOF |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#line 58 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub catalyst_files { |
44
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
45
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
chdir $FindBin::Bin; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
my @files; |
49
|
0
|
|
|
|
|
0
|
opendir CATDIR, '.'; |
50
|
0
|
|
|
|
|
0
|
CATFILES: for my $name ( readdir CATDIR ) { |
51
|
|
|
|
|
|
|
for my $ignore (@IGNORE) { |
52
|
|
|
|
|
|
|
next CATFILES if $name =~ /^$ignore$/; |
53
|
|
|
|
|
|
|
next CATFILES if $name !~ /\w/; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
push @files, $name; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
closedir CATDIR; |
58
|
|
|
|
|
|
|
my @path = split '-', $self->name; |
59
|
|
|
|
|
|
|
for my $orig (@files) { |
60
|
1
|
|
|
1
|
0
|
600
|
my $path = File::Spec->catdir( 'blib', 'lib', @path, $orig ); |
61
|
|
|
|
|
|
|
rcopy( $orig, $path ); |
62
|
1
|
|
|
|
|
52
|
} |
63
|
|
|
|
|
|
|
} |
64
|
1
|
|
|
|
|
13
|
|
65
|
1
|
|
|
|
|
88
|
#line 84 |
66
|
1
|
|
|
|
|
85
|
|
67
|
12
|
|
|
|
|
31
|
sub catalyst_ignore_all { |
68
|
101
|
100
|
|
|
|
3535
|
my ( $self, $ignore ) = @_; |
69
|
94
|
100
|
|
|
|
402
|
@IGNORE = @$ignore; |
70
|
|
|
|
|
|
|
} |
71
|
3
|
|
|
|
|
11
|
|
72
|
|
|
|
|
|
|
#line 93 |
73
|
1
|
|
|
|
|
57
|
|
74
|
1
|
|
|
|
|
61
|
sub catalyst_ignore { |
75
|
1
|
|
|
|
|
19
|
my ( $self, @ignore ) = @_; |
76
|
3
|
|
|
|
|
10688
|
push @IGNORE, @ignore; |
77
|
3
|
|
|
|
|
49
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#line 102 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Workaround for a namespace conflict |
82
|
|
|
|
|
|
|
sub catalyst_par { |
83
|
|
|
|
|
|
|
my ( $self, $par ) = @_; |
84
|
|
|
|
|
|
|
return if $SAFETY; |
85
|
|
|
|
|
|
|
$SAFETY++; |
86
|
0
|
|
|
0
|
0
|
|
my $name = $self->name; |
87
|
0
|
|
|
|
|
|
my $usage = $USAGE; |
88
|
|
|
|
|
|
|
$usage =~ s/"/\\"/g; |
89
|
|
|
|
|
|
|
my $class_string = join "', '", @CLASSES; |
90
|
|
|
|
|
|
|
$class_string = "'$class_string'" if $class_string; |
91
|
|
|
|
|
|
|
$self->postamble(<<EOF); |
92
|
|
|
|
|
|
|
catalyst_par :: all |
93
|
|
|
|
|
|
|
\t\$(NOECHO) \$(PERL) -Ilib -Minc::Module::Install -MModule::Install::Catalyst -e"Catalyst::Module::Install::_catalyst_par( '$par', '$name', { CLASSES => [$class_string], CORE => $CORE, ENGINE => '$ENGINE', MULTIARCH => $MULTIARCH, SCRIPT => '$SCRIPT', USAGE => q#$usage# } )" |
94
|
|
|
|
|
|
|
EOF |
95
|
0
|
|
|
0
|
0
|
|
print <<EOF; |
96
|
0
|
|
|
|
|
|
Please run "make catalyst_par" to create the PAR package! |
97
|
|
|
|
|
|
|
EOF |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#line 125 |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub catalyst_par_core { |
103
|
|
|
|
|
|
|
my ( $self, $core ) = @_; |
104
|
|
|
|
|
|
|
$core ? ( $CORE = $core ) : $CORE++; |
105
|
0
|
|
|
0
|
0
|
|
} |
106
|
0
|
0
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
#line 134 |
108
|
0
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
sub catalyst_par_classes { |
110
|
0
|
|
|
|
|
|
my ( $self, @classes ) = @_; |
111
|
0
|
|
|
|
|
|
push @CLASSES, @classes; |
112
|
0
|
0
|
|
|
|
|
} |
113
|
0
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#line 143 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub catalyst_par_engine { |
117
|
0
|
|
|
|
|
|
my ( $self, $engine ) = @_; |
118
|
|
|
|
|
|
|
$ENGINE = $engine; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
#line 152 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub catalyst_par_multiarch { |
124
|
|
|
|
|
|
|
my ( $self, $multiarch ) = @_; |
125
|
|
|
|
|
|
|
$multiarch ? ( $MULTIARCH = $multiarch ) : $MULTIARCH++; |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
0
|
0
|
|
|
128
|
0
|
0
|
|
|
|
|
#line 161 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub catalyst_par_script { |
131
|
|
|
|
|
|
|
my ( $self, $script ) = @_; |
132
|
|
|
|
|
|
|
$SCRIPT = $script; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#line 170 |
136
|
0
|
|
|
0
|
0
|
|
|
137
|
0
|
|
|
|
|
|
sub catalyst_par_usage { |
138
|
|
|
|
|
|
|
my ( $self, $usage ) = @_; |
139
|
|
|
|
|
|
|
$USAGE = $usage; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
package Catalyst::Module::Install; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
use strict; |
145
|
0
|
|
|
0
|
0
|
|
use FindBin; |
146
|
0
|
|
|
|
|
|
use File::Copy::Recursive 'rmove'; |
147
|
|
|
|
|
|
|
use File::Spec (); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
sub _catalyst_par { |
150
|
|
|
|
|
|
|
my ( $par, $class_name, $opts ) = @_; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $ENGINE = $opts->{ENGINE}; |
153
|
|
|
|
|
|
|
my $CLASSES = $opts->{CLASSES} || []; |
154
|
0
|
|
|
0
|
0
|
|
my $USAGE = $opts->{USAGE}; |
155
|
0
|
0
|
|
|
|
|
my $SCRIPT = $opts->{SCRIPT}; |
156
|
|
|
|
|
|
|
my $MULTIARCH = $opts->{MULTIARCH}; |
157
|
|
|
|
|
|
|
my $CORE = $opts->{CORE}; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
my $name = $class_name; |
160
|
|
|
|
|
|
|
$name =~ s/::/_/g; |
161
|
|
|
|
|
|
|
$name = lc $name; |
162
|
|
|
|
|
|
|
$par ||= "$name.par"; |
163
|
0
|
|
|
0
|
0
|
|
my $engine = $ENGINE || 'CGI'; |
164
|
0
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# Check for PAR |
166
|
|
|
|
|
|
|
eval "use PAR ()"; |
167
|
|
|
|
|
|
|
die "Please install PAR\n" if $@; |
168
|
|
|
|
|
|
|
eval "use PAR::Packer ()"; |
169
|
|
|
|
|
|
|
die "Please install PAR::Packer\n" if $@; |
170
|
|
|
|
|
|
|
eval "use App::Packer::PAR ()"; |
171
|
|
|
|
|
|
|
die "Please install App::Packer::PAR\n" if $@; |
172
|
0
|
|
|
0
|
0
|
|
eval "use Module::ScanDeps ()"; |
173
|
0
|
|
|
|
|
|
die "Please install Module::ScanDeps\n" if $@; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $root = $FindBin::Bin; |
176
|
|
|
|
|
|
|
$class_name =~ s/-/::/g; |
177
|
|
|
|
|
|
|
my $path = File::Spec->catfile( 'blib', 'lib', split( '::', $class_name ) ); |
178
|
1
|
|
|
1
|
|
8
|
$path .= '.pm'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
54
|
|
179
|
1
|
|
|
1
|
|
6
|
unless ( -f $path ) { |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
180
|
1
|
|
|
1
|
|
7
|
print qq/Not writing PAR, "$path" doesn't exist\n/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
181
|
1
|
|
|
1
|
|
5
|
return 0; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
941
|
|
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
print qq/Writing PAR "$par"\n/; |
184
|
0
|
|
|
0
|
|
|
chdir File::Spec->catdir( $root, 'blib' ); |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
my $par_pl = 'par.pl'; |
187
|
0
|
|
0
|
|
|
|
unlink $par_pl; |
188
|
0
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
my $version = $Catalyst::VERSION; |
190
|
0
|
|
|
|
|
|
my $class = $class_name; |
191
|
0
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
my $classes = ''; |
193
|
0
|
|
|
|
|
|
$classes .= " require $_;\n" for @$CLASSES; |
194
|
0
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
unlink $par_pl; |
196
|
0
|
|
0
|
|
|
|
|
197
|
0
|
|
0
|
|
|
|
my $usage = $USAGE || <<"EOF"; |
198
|
|
|
|
|
|
|
Usage: |
199
|
|
|
|
|
|
|
[parl] $name\[.par] [script] [arguments] |
200
|
0
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
|
Examples: |
202
|
0
|
|
|
|
|
|
parl $name.par $name\_server.pl -r |
203
|
0
|
0
|
|
|
|
|
myapp $name\_cgi.pl |
204
|
0
|
|
|
|
|
|
EOF |
205
|
0
|
0
|
|
|
|
|
|
206
|
0
|
|
|
|
|
|
my $script = $SCRIPT; |
207
|
0
|
0
|
|
|
|
|
my $tmp_file = IO::File->new("> $par_pl "); |
208
|
|
|
|
|
|
|
print $tmp_file <<"EOF"; |
209
|
0
|
|
|
|
|
|
if ( \$ENV{PAR_PROGNAME} ) { |
210
|
0
|
|
|
|
|
|
my \$zip = \$PAR::LibCache{\$ENV{PAR_PROGNAME}} |
211
|
0
|
|
|
|
|
|
|| Archive::Zip->new(__FILE__); |
212
|
0
|
|
|
|
|
|
my \$script = '$script'; |
213
|
0
|
0
|
|
|
|
|
\$ARGV[0] ||= \$script if \$script; |
214
|
0
|
|
|
|
|
|
if ( ( \@ARGV == 0 ) || ( \$ARGV[0] eq '-h' ) || ( \$ARGV[0] eq '-help' )) { |
215
|
0
|
|
|
|
|
|
my \@members = \$zip->membersMatching('.*script/.*\.pl'); |
216
|
|
|
|
|
|
|
my \$list = " Available scripts:\\n"; |
217
|
0
|
|
|
|
|
|
for my \$member ( \@members ) { |
218
|
0
|
|
|
|
|
|
my \$name = \$member->fileName; |
219
|
|
|
|
|
|
|
\$name =~ /(\\w+\\.pl)\$/; |
220
|
0
|
|
|
|
|
|
\$name = \$1; |
221
|
0
|
|
|
|
|
|
next if \$name =~ /^main\.pl\$/; |
222
|
|
|
|
|
|
|
next if \$name =~ /^par\.pl\$/; |
223
|
0
|
|
|
|
|
|
\$list .= " \$name\\n"; |
224
|
0
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
die <<"END"; |
226
|
0
|
|
|
|
|
|
$usage |
227
|
0
|
|
|
|
|
|
\$list |
228
|
|
|
|
|
|
|
END |
229
|
0
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
my \$file = shift \@ARGV; |
231
|
0
|
|
0
|
|
|
|
\$file =~ s/^.*[\\/\\\\]//; |
232
|
|
|
|
|
|
|
\$file =~ s/\\.[^.]*\$//i; |
233
|
|
|
|
|
|
|
my \$member = eval { \$zip->memberNamed("./script/\$file.pl") }; |
234
|
|
|
|
|
|
|
die qq/Can't open perl script "\$file"\n/ unless \$member; |
235
|
|
|
|
|
|
|
PAR::_run_member( \$member, 1 ); |
236
|
|
|
|
|
|
|
} |
237
|
|
|
|
|
|
|
else { |
238
|
|
|
|
|
|
|
require lib; |
239
|
|
|
|
|
|
|
import lib 'lib'; |
240
|
0
|
|
|
|
|
|
\$ENV{CATALYST_ENGINE} = '$engine'; |
241
|
0
|
|
|
|
|
|
require $class; |
242
|
0
|
|
|
|
|
|
import $class; |
243
|
|
|
|
|
|
|
require Catalyst::Helper; |
244
|
|
|
|
|
|
|
require Catalyst::Test; |
245
|
|
|
|
|
|
|
require Catalyst::Engine::HTTP; |
246
|
|
|
|
|
|
|
require Catalyst::Engine::CGI; |
247
|
|
|
|
|
|
|
require Catalyst::Controller; |
248
|
|
|
|
|
|
|
require Catalyst::Model; |
249
|
|
|
|
|
|
|
require Catalyst::View; |
250
|
|
|
|
|
|
|
require Getopt::Long; |
251
|
|
|
|
|
|
|
require Pod::Usage; |
252
|
|
|
|
|
|
|
require Pod::Text; |
253
|
|
|
|
|
|
|
$classes |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
EOF |
256
|
|
|
|
|
|
|
$tmp_file->close; |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
# Create package |
259
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { }; |
260
|
|
|
|
|
|
|
open my $olderr, '>&STDERR'; |
261
|
|
|
|
|
|
|
open STDERR, '>', File::Spec->devnull; |
262
|
|
|
|
|
|
|
my %opt = ( |
263
|
|
|
|
|
|
|
'x' => 1, |
264
|
|
|
|
|
|
|
'n' => 0, |
265
|
|
|
|
|
|
|
'o' => $par, |
266
|
|
|
|
|
|
|
'a' => [ grep( !/par.pl/, glob '.' ) ], |
267
|
|
|
|
|
|
|
'p' => 1, |
268
|
|
|
|
|
|
|
'B' => $CORE, |
269
|
|
|
|
|
|
|
'm' => $MULTIARCH |
270
|
|
|
|
|
|
|
); |
271
|
|
|
|
|
|
|
App::Packer::PAR->new( |
272
|
|
|
|
|
|
|
frontend => 'Module::ScanDeps', |
273
|
|
|
|
|
|
|
backend => 'PAR::Packer', |
274
|
|
|
|
|
|
|
frontopts => \%opt, |
275
|
|
|
|
|
|
|
backopts => \%opt, |
276
|
|
|
|
|
|
|
args => ['par.pl'], |
277
|
|
|
|
|
|
|
)->go; |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
open STDERR, '>&', $olderr; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
unlink $par_pl; |
282
|
|
|
|
|
|
|
chdir $root; |
283
|
|
|
|
|
|
|
rmove( File::Spec->catfile( 'blib', $par ), $par ); |
284
|
|
|
|
|
|
|
return 1; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
#line 331 |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
1; |