| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Getopt::Complete::LazyOptions; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = $Getopt::Complete::VERSION; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
|
8
|
0
|
|
|
0
|
0
|
|
my ($class, $callback) = @_; |
|
9
|
0
|
|
|
|
|
|
return bless { callback => $callback }, $class; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
13
|
0
|
|
|
0
|
|
|
my ($c,$m) = ($AUTOLOAD =~ /^(.*)::([^\:]+)$/); |
|
14
|
0
|
0
|
|
|
|
|
return if $m eq 'DESTROY'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $self = shift; |
|
17
|
0
|
|
|
|
|
|
my $callback = $self->{callback}; |
|
18
|
0
|
|
|
|
|
|
my @spec; |
|
19
|
0
|
0
|
|
|
|
|
if (ref($callback) eq 'SCALAR') { |
|
20
|
2
|
|
|
2
|
|
10
|
no strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
80
|
|
|
21
|
2
|
|
|
2
|
|
11
|
no warnings; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
376
|
|
|
22
|
0
|
|
|
|
|
|
my $class = $$callback; |
|
23
|
0
|
|
|
|
|
|
my $path = $class; |
|
24
|
0
|
|
|
|
|
|
$path =~ s/::/\//g; |
|
25
|
0
|
|
|
|
|
|
$path .= '.pm.opts'; |
|
26
|
0
|
|
|
|
|
|
my @possible = map { $_ . '/' . $path } @INC; |
|
|
0
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my @actual = grep { -e $_ } @possible; |
|
|
0
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#print STDERR ">> possible @possible\n\nactual @actual\n\n"; |
|
29
|
0
|
|
|
|
|
|
my $spec; |
|
30
|
0
|
0
|
|
|
|
|
if (@actual) { |
|
31
|
0
|
|
|
|
|
|
my $data = `cat $actual[0]`; |
|
32
|
0
|
|
|
|
|
|
$spec = eval $data; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
else { |
|
35
|
|
|
|
|
|
|
# print STDERR ">> redo $class!\n"; |
|
36
|
0
|
|
|
|
|
|
local $ENV{GETOPT_COMPLETE_CACHE} = 1; |
|
37
|
0
|
|
|
|
|
|
eval "use $class"; |
|
38
|
0
|
0
|
|
|
|
|
die $@ if $@; |
|
39
|
2
|
|
|
2
|
|
12
|
no strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
67
|
|
|
40
|
2
|
|
|
2
|
|
11
|
no warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
329
|
|
|
41
|
0
|
|
|
|
|
|
$spec = ${ $class . '::OPTS_SPEC' }; |
|
|
0
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#print STDERR ">> got @spec\n"; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
0
|
|
|
|
|
|
@spec = @$spec; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
else { |
|
47
|
0
|
|
|
|
|
|
@spec = $self->{callback}(); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
0
|
|
|
|
|
|
%$self = ( |
|
50
|
|
|
|
|
|
|
sub_commands => [], |
|
51
|
|
|
|
|
|
|
option_specs => {}, |
|
52
|
|
|
|
|
|
|
completion_handlers => {}, |
|
53
|
|
|
|
|
|
|
parse_errors => undef, |
|
54
|
|
|
|
|
|
|
%$self, |
|
55
|
|
|
|
|
|
|
); |
|
56
|
0
|
|
|
|
|
|
bless $self, 'Getopt::Complete::Options'; |
|
57
|
0
|
|
|
|
|
|
$self->_init(@spec); |
|
58
|
0
|
|
|
|
|
|
$self->$m(@_); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Getopt::Complete::LazyOptions - internal object used as a placeholder for unprocessed options |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 VERSION |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This document describes Getopt::Complete::LazyOptions 0.26. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Getopt::Complete ( |
|
76
|
|
|
|
|
|
|
"foo=n" => [11,22,33], |
|
77
|
|
|
|
|
|
|
"bar=s" => "f", |
|
78
|
|
|
|
|
|
|
">" => sub { |
|
79
|
|
|
|
|
|
|
my $values = []; |
|
80
|
|
|
|
|
|
|
# code to generate completions for this option here... |
|
81
|
|
|
|
|
|
|
return $values; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This class is used internally by Getopt::Complete::Options. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|