| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Astro::App::Satpass2::Macro::Code; |
|
2
|
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
1657
|
use 5.008; |
|
|
20
|
|
|
|
|
71
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
106
|
use strict; |
|
|
20
|
|
|
|
|
41
|
|
|
|
20
|
|
|
|
|
516
|
|
|
6
|
20
|
|
|
20
|
|
102
|
use warnings; |
|
|
20
|
|
|
|
|
48
|
|
|
|
20
|
|
|
|
|
767
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
20
|
|
|
20
|
|
146
|
use parent qw{ Astro::App::Satpass2::Macro }; |
|
|
20
|
|
|
|
|
48
|
|
|
|
20
|
|
|
|
|
135
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
20
|
|
|
|
|
2322
|
use Astro::App::Satpass2::Utils qw{ |
|
11
|
|
|
|
|
|
|
expand_tilde |
|
12
|
|
|
|
|
|
|
load_package |
|
13
|
|
|
|
|
|
|
quoter |
|
14
|
|
|
|
|
|
|
@CARP_NOT |
|
15
|
20
|
|
|
20
|
|
1567
|
}; |
|
|
20
|
|
|
|
|
80
|
|
|
16
|
20
|
|
|
20
|
|
167
|
use File::Spec; |
|
|
20
|
|
|
|
|
57
|
|
|
|
20
|
|
|
|
|
4786
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.051'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub init { |
|
21
|
1
|
|
|
1
|
1
|
4
|
my ( $self ) = @_; |
|
22
|
1
|
|
|
|
|
7
|
$self->SUPER::init(); |
|
23
|
1
|
|
|
|
|
7
|
my $parent = $self->parent(); |
|
24
|
1
|
|
|
|
|
5
|
my %popt = ( complaint => 'wail', fatal => 'wail' ); |
|
25
|
|
|
|
|
|
|
exists $self->{lib} |
|
26
|
1
|
50
|
|
|
|
30
|
and $popt{lib} = $self->expand_tilde( $self->{lib} ); |
|
27
|
|
|
|
|
|
|
defined $self->{lib} |
|
28
|
|
|
|
|
|
|
and not $self->{relative} |
|
29
|
|
|
|
|
|
|
and not $self->{lib} =~ m/ \A ~ /smx |
|
30
|
1
|
50
|
33
|
|
|
8
|
and $self->{lib} = File::Spec->rel2abs( $self->{lib} ); |
|
|
|
|
33
|
|
|
|
|
|
31
|
1
|
|
|
|
|
21
|
my $module = $self->load_package( |
|
32
|
|
|
|
|
|
|
\%popt, $self->name(), 'Astro::App::Satpass2::Macro::Code' |
|
33
|
|
|
|
|
|
|
); |
|
34
|
0
|
0
|
|
|
|
|
$module->isa( 'Astro::App::Satpass2' ) |
|
35
|
|
|
|
|
|
|
or $self->wail( "$module is not a subclass of Astro::App::Satpass2" ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my %implements; # Names and references to found code |
|
38
|
0
|
|
|
|
|
|
my $stb = "${module}::"; # Name of loaded symbol table |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Fairly deep magic begins here. We need symbolic references to |
|
41
|
|
|
|
|
|
|
# traverse the symbol table of the loaded code, so: |
|
42
|
20
|
|
|
20
|
|
171
|
no strict qw{ refs }; |
|
|
20
|
|
|
|
|
45
|
|
|
|
20
|
|
|
|
|
6773
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
foreach my $name ( keys %$stb ) { |
|
45
|
0
|
|
|
|
|
|
my $val = $stb->{$name}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# We are only interested in symbols that start with word |
|
48
|
|
|
|
|
|
|
# characters, excluding '_' |
|
49
|
0
|
0
|
0
|
|
|
|
$name =~ m/ \A \w /smx |
|
50
|
|
|
|
|
|
|
and not $name =~ m/ \A _ /smx |
|
51
|
|
|
|
|
|
|
or next; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# We need a reference to the entry's glob, which we obtain by |
|
54
|
|
|
|
|
|
|
# symbolic reference. |
|
55
|
0
|
|
|
|
|
|
my $glob = \$val; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# If the code slot is empty we ignore it. |
|
58
|
0
|
|
|
|
|
|
*{$glob}{CODE} |
|
59
|
0
|
0
|
|
|
|
|
or next; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# If the code does not have the Verb() attribute, we ignore it. |
|
62
|
|
|
|
|
|
|
# TODO technically we have an encapsulation failure here which |
|
63
|
|
|
|
|
|
|
# needs to be fixed up. |
|
64
|
0
|
0
|
|
|
|
|
$parent->__get_attr( *{$glob}{CODE}, 'Verb' ) |
|
|
0
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
or next; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Record the fact that the module defines this name. |
|
68
|
0
|
|
|
|
|
|
$implements{$name} = *{$glob}{CODE}; |
|
|
0
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# End of symbol table magic. |
|
72
|
0
|
|
|
|
|
|
$self->{implements} = \%implements; |
|
73
|
0
|
|
|
|
|
|
return; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub execute { |
|
77
|
0
|
|
|
0
|
1
|
|
my ( $self, $name, @args ) = @_; |
|
78
|
0
|
|
|
|
|
|
my $code = $self->implements( $name, required => 1 ); |
|
79
|
0
|
|
|
|
|
|
return $code->( $self->parent(), @args ); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub has_lib { |
|
83
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
|
84
|
0
|
|
|
|
|
|
return exists $self->{lib}; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub lib { |
|
88
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
|
89
|
0
|
|
|
|
|
|
return $self->{lib}; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub relative { |
|
93
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
|
94
|
0
|
|
|
|
|
|
return $self->{relative}; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |