| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
21
|
|
|
21
|
|
119
|
use strict; |
|
|
21
|
|
|
|
|
32
|
|
|
|
21
|
|
|
|
|
535
|
|
|
2
|
21
|
|
|
21
|
|
90
|
use warnings; |
|
|
21
|
|
|
|
|
30
|
|
|
|
21
|
|
|
|
|
945
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package File::Util::Interface::Classic; |
|
5
|
|
|
|
|
|
|
$File::Util::Interface::Classic::VERSION = '4.201720'; |
|
6
|
|
|
|
|
|
|
# ABSTRACT: Legacy call interface to File::Util |
|
7
|
|
|
|
|
|
|
|
|
8
|
21
|
|
|
21
|
|
113
|
use Scalar::Util qw( blessed ); |
|
|
21
|
|
|
|
|
35
|
|
|
|
21
|
|
|
|
|
1017
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
21
|
|
|
21
|
|
139
|
use File::Util::Definitions qw( :all ); |
|
|
21
|
|
|
|
|
39
|
|
|
|
21
|
|
|
|
|
4491
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
21
|
|
|
|
|
1141
|
use vars qw( |
|
13
|
|
|
|
|
|
|
@ISA $AUTHORITY |
|
14
|
|
|
|
|
|
|
@EXPORT_OK %EXPORT_TAGS |
|
15
|
21
|
|
|
21
|
|
138
|
); |
|
|
21
|
|
|
|
|
35
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
21
|
|
|
21
|
|
118
|
use Exporter; |
|
|
21
|
|
|
|
|
46
|
|
|
|
21
|
|
|
|
|
9512
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$AUTHORITY = 'cpan:TOMMY'; |
|
20
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
|
21
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
|
22
|
|
|
|
|
|
|
_myargs |
|
23
|
|
|
|
|
|
|
_remove_opts |
|
24
|
|
|
|
|
|
|
_names_values |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
%EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
31
|
|
|
|
|
|
|
# File::Util::Interface::Classic::_myargs() |
|
32
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
33
|
|
|
|
|
|
|
sub _myargs { |
|
34
|
|
|
|
|
|
|
|
|
35
|
786
|
100
|
66
|
786
|
|
2906
|
shift @_ if ( blessed $_[0] || ( $_[0] && $_[0] =~ /^File::Util/ ) ); |
|
|
|
|
66
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
786
|
100
|
|
|
|
1741
|
return wantarray ? @_ : $_[0] |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
42
|
|
|
|
|
|
|
# File::Util::Interface::Classic::_remove_opts() |
|
43
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
44
|
|
|
|
|
|
|
sub _remove_opts { |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
|
0
|
shift; # we don't need "$this" here |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
my $args = shift @_; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
0
|
return unless ref $args eq 'ARRAY'; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
my @triage = @$args; @$args = (); |
|
|
0
|
|
|
|
|
0
|
|
|
53
|
0
|
|
|
|
|
0
|
my $opts = { }; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
while ( @triage ) { |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
0
|
my $arg = shift @triage; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# if an argument is '', 0, or undef, it's obviously not an --option ... |
|
60
|
0
|
0
|
0
|
|
|
0
|
push @$args, $arg and next unless $arg; # ...so give it back to the @$args |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# hmmm. looks like an "--option" argument, if: |
|
63
|
0
|
0
|
|
|
|
0
|
if ( $arg =~ /^--/ ) { |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# it's either a bare "--option", or it's an "--option=value" pair |
|
66
|
0
|
|
|
|
|
0
|
my ( $opt, $value ) = split /=/, $arg; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# bare version |
|
69
|
0
|
0
|
|
|
|
0
|
$opts->{ $opt } = defined $value ? $value : 1; |
|
70
|
|
|
|
|
|
|
# ^^^^^^^ if $value is undef, it was a --flag (true) |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# sanitized version, remove leading "--" ... |
|
73
|
0
|
|
|
|
|
0
|
my $clean_name = substr $opt, 2; |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ...and replace non-alnum chars with "_" so the names can be |
|
76
|
|
|
|
|
|
|
# referenced as hash keys without superfluous quoting and escaping |
|
77
|
0
|
|
|
|
|
0
|
$clean_name =~ s/[^[:alnum:]]/_/g; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
0
|
$opts->{ $clean_name } = defined $value ? $value : 1; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
else { |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# but if it's not an "--option" type arg, give it back to the @$args |
|
84
|
0
|
|
|
|
|
0
|
push @$args, $arg; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
return $opts; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
93
|
|
|
|
|
|
|
# File::Util::Interface::Classic::_names_values() |
|
94
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
95
|
|
|
|
|
|
|
sub _names_values { |
|
96
|
|
|
|
|
|
|
|
|
97
|
171
|
|
|
171
|
|
212
|
shift; # we don't need "$this" here |
|
98
|
|
|
|
|
|
|
|
|
99
|
171
|
|
|
|
|
275
|
my @in_pairs = @_; |
|
100
|
171
|
|
|
|
|
207
|
my $out_pairs = { }; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# this code no longer tries to catch foolishness such as names that are |
|
103
|
|
|
|
|
|
|
# undef other than skipping over them, for lack of sane options to deal |
|
104
|
|
|
|
|
|
|
# with such insane input ;-) |
|
105
|
171
|
|
|
|
|
484
|
while ( my ( $name, $val ) = splice @in_pairs, 0, 2 ) { |
|
106
|
|
|
|
|
|
|
|
|
107
|
144
|
100
|
|
|
|
255
|
next unless defined $name; |
|
108
|
|
|
|
|
|
|
|
|
109
|
142
|
|
|
|
|
421
|
$out_pairs->{ $name } = $val; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
171
|
|
|
|
|
307
|
return $out_pairs; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
117
|
|
|
|
|
|
|
# File::Util::Interface::Classic::DESTROY() |
|
118
|
|
|
|
|
|
|
# -------------------------------------------------------- |
|
119
|
|
|
|
2
|
|
|
sub DESTROY { } |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |