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