line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Perl::Command; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
28983
|
use strict 'vars', 'subs'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
77
|
|
5
|
2
|
|
|
2
|
|
60
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
84
|
|
6
|
2
|
|
|
2
|
|
21
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
146
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.01; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Perl::Command - return an ARGV for running this perl |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Perl::Command; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# clear PERL5LIB and PERL5OPT to stop any monkey business |
19
|
|
|
|
|
|
|
NOLIB; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
system(@PERL, "-le", "print for @INC"); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module exports one symbol - @PERL, which is very similar to C<$^X> |
26
|
|
|
|
|
|
|
(see L<perlvar/$^X>), except it also contains a list of commands which |
27
|
|
|
|
|
|
|
will give the sub-perl all of the same @INC paths as this one. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This is a very trivial module; its principle use is for bundling with |
30
|
|
|
|
|
|
|
modules whose test scripts need to test running scripts. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our @PERL; |
35
|
2
|
|
|
2
|
|
19
|
use base 'Exporter'; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
801
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our @EXPORT = qw(@PERL NOLIB); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
BEGIN { |
40
|
2
|
|
|
2
|
|
18
|
local ( $ENV{PERL5LIB} ) = ""; |
41
|
2
|
|
|
|
|
14
|
local ( $ENV{PERL5OPT} ) = ""; |
42
|
2
|
|
|
|
|
32513
|
my @default_inc = `$^X -le 'print for \@INC'`; |
43
|
2
|
|
|
|
|
71
|
chomp($_) for @default_inc; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
13
|
my @add_inc; |
46
|
2
|
|
|
|
|
29
|
for my $path (@INC) { |
47
|
24
|
50
|
|
|
|
304
|
next if ref $path; |
48
|
24
|
100
|
|
|
|
92
|
if ( !grep { $_ eq $path } @default_inc ) { |
|
120
|
|
|
|
|
415
|
|
49
|
14
|
|
|
|
|
138
|
push @add_inc, $path; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
2
|
|
|
|
|
11
|
@PERL = ( $^X, map { "-Mlib=$_" } @add_inc ); |
|
14
|
|
|
|
|
493
|
|
53
|
|
|
|
|
|
|
} ## end BEGIN |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub NOLIB { |
56
|
0
|
|
|
0
|
0
|
|
delete $ENV{PERL5LIB}; |
57
|
0
|
|
|
|
|
|
delete $ENV{PERL5OPT}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Sam Vilain, <samv@cpan.org>. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 LICENSE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Copyright (c) 2008, Catalyst IT (NZ) Ltd. This program is free |
71
|
|
|
|
|
|
|
software; you may use it and/or redistribute it under the same terms |
72
|
|
|
|
|
|
|
as Perl itself. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 CHANGELOG |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
For the complete history, |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
git clone git://utsl.gen.nz/Perl-Command |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 BUGS / SUBMISSIONS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
If you find an error, please submit the failure as an addition to the |
83
|
|
|
|
|
|
|
test suite, as a patch. Version control is at: |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
git://utsl.gen.nz/Perl-Command |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
See the file F<SubmittingPatches> in the distribution for a basic |
88
|
|
|
|
|
|
|
command sequence you can use for this. Feel free to also harass me |
89
|
|
|
|
|
|
|
via L<https://rt.cpan.org/Ticket/Create.html?Queue=Perl%3A%3ACommand> |
90
|
|
|
|
|
|
|
or mail me something other than a patch, but you win points for just |
91
|
|
|
|
|
|
|
submitting a patch in `git-format-patch` format that I can easily |
92
|
|
|
|
|
|
|
apply and work on next time. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
To take that to its logical extension, you can expect well written |
95
|
|
|
|
|
|
|
patch series which include test cases and clearly described |
96
|
|
|
|
|
|
|
progressive changes to spur me to release a new version of the module |
97
|
|
|
|
|
|
|
with your great new feature in it. Because I hopefully didn't have to |
98
|
|
|
|
|
|
|
do any coding for that, just review. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|