line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Std::Strict; |
2
|
1
|
|
|
1
|
|
24933
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
6
|
use vars qw(@EXPORT @EXPORT_OK $VERSION @ISA %OPT $opt_string @OPT_KEYS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
4
|
1
|
|
|
1
|
|
6
|
use Exporter; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
154
|
|
5
|
|
|
|
|
|
|
@EXPORT_OK = qw(%OPT &opt); |
6
|
|
|
|
|
|
|
@EXPORT = qw(OPT); |
7
|
|
|
|
|
|
|
@ISA = qw/Exporter/; |
8
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%02d", q$Revision: 1.1.1.1 $ =~ /(\d+)/g; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import { |
11
|
1
|
|
|
1
|
|
8
|
my $class = shift; |
12
|
1
|
|
|
|
|
2
|
$opt_string = shift; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
3
|
my $caller = caller; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
### $class |
18
|
|
|
|
|
|
|
### $caller |
19
|
|
|
|
|
|
|
### $opt_string |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
328
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#*{"$caller\::OPT"} = \%OPT; |
24
|
1
|
|
|
|
|
2
|
*{"$caller\::OPT"} = \%OPT; |
|
1
|
|
|
|
|
5
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
2734
|
require Getopt::Std; |
28
|
1
|
|
|
|
|
46
|
Getopt::Std::getopts($opt_string, \%OPT); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
### %OPT |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
58
|
my $_opt_string = $opt_string; |
33
|
1
|
|
|
|
|
4
|
$_opt_string=~s/\W//g; |
34
|
1
|
|
|
|
|
4
|
@OPT_KEYS = split(//, $_opt_string); |
35
|
|
|
|
|
|
|
### @OPT_KEYS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# make variables |
38
|
1
|
|
|
|
|
3
|
for my $opt_key (@OPT_KEYS){ |
39
|
3
|
|
|
|
|
6
|
*{"$caller\::opt_$opt_key"} = \$OPT{$opt_key}; |
|
3
|
|
|
|
|
13
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
### @_ |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
1993
|
Getopt::Std::Strict->export_to_level(1, ( $class, @_)); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub opt { |
51
|
5
|
|
|
5
|
1
|
983
|
my $opt_key = shift; |
52
|
5
|
|
|
|
|
11
|
my $opt_val = shift; |
53
|
5
|
50
|
|
|
|
13
|
if (defined $opt_val){ |
54
|
0
|
|
|
|
|
0
|
$OPT{$opt_key} = $opt_val; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
5
|
100
|
0
|
|
|
77
|
$opt_string=~/$opt_key/ |
58
|
|
|
|
|
|
|
or die("There's no $opt_key option") |
59
|
|
|
|
|
|
|
and return; |
60
|
4
|
|
|
|
|
20
|
return $OPT{$opt_key}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |