| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Astro::App::Satpass2::Macro; |
|
2
|
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
10288
|
use 5.008; |
|
|
20
|
|
|
|
|
72
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
119
|
use strict; |
|
|
20
|
|
|
|
|
48
|
|
|
|
20
|
|
|
|
|
448
|
|
|
6
|
20
|
|
|
20
|
|
107
|
use warnings; |
|
|
20
|
|
|
|
|
57
|
|
|
|
20
|
|
|
|
|
757
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
20
|
|
|
|
|
2254
|
use Astro::App::Satpass2::Utils qw{ |
|
9
|
|
|
|
|
|
|
instance |
|
10
|
|
|
|
|
|
|
CODE_REF |
|
11
|
|
|
|
|
|
|
@CARP_NOT |
|
12
|
20
|
|
|
20
|
|
212
|
}; |
|
|
20
|
|
|
|
|
57
|
|
|
13
|
20
|
|
|
20
|
|
8259
|
use Astro::App::Satpass2::Warner; |
|
|
20
|
|
|
|
|
60
|
|
|
|
20
|
|
|
|
|
738
|
|
|
14
|
20
|
|
|
20
|
|
152
|
use Scalar::Util 1.26 qw{ weaken }; |
|
|
20
|
|
|
|
|
404
|
|
|
|
20
|
|
|
|
|
13475
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.051_01'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
17
|
|
|
17
|
1
|
151
|
my ( $class, %arg ) = @_; |
|
20
|
17
|
|
33
|
|
|
91
|
my $self = bless \%arg, ref $class || $class; |
|
21
|
17
|
|
|
|
|
76
|
$self->init(); |
|
22
|
16
|
|
|
|
|
61
|
return $self; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub execute { |
|
26
|
0
|
|
|
0
|
1
|
0
|
__PACKAGE__->weep( 'execute() must be overridden' ); |
|
27
|
0
|
|
|
|
|
0
|
return; # weep() dies, but Perl::Critic does not know this. |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub generator { |
|
31
|
9
|
|
|
9
|
1
|
32
|
my ( $self, @args ) = @_; |
|
32
|
|
|
|
|
|
|
$self->{generate} |
|
33
|
9
|
50
|
|
|
|
31
|
or $self->weep( q{'generate' attribute not specified} ); |
|
34
|
|
|
|
|
|
|
@args |
|
35
|
9
|
50
|
|
|
|
21
|
or return $self->{generate}->( $self, sort $self->implements() ); |
|
36
|
9
|
|
|
|
|
20
|
foreach my $macro ( @args ) { |
|
37
|
9
|
|
|
|
|
39
|
$self->implements( $macro, required => 1 ); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
9
|
|
|
|
|
30
|
return $self->{generate}->( $self, @args ); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub implements { |
|
43
|
28
|
|
|
28
|
1
|
82
|
my ( $self, $name, %arg ) = @_; |
|
44
|
|
|
|
|
|
|
defined $name |
|
45
|
28
|
50
|
|
|
|
62
|
or return ( keys %{ $self->{implements} } ); |
|
|
0
|
|
|
|
|
0
|
|
|
46
|
|
|
|
|
|
|
$self->{implements}{$name} |
|
47
|
|
|
|
|
|
|
or not $arg{required} |
|
48
|
28
|
50
|
33
|
|
|
81
|
or $self->wail( "This object does not implement macro $name" ); |
|
49
|
28
|
|
|
|
|
75
|
return $self->{implements}{$name}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub init { |
|
53
|
17
|
|
|
17
|
1
|
34
|
my ( $self ) = @_; |
|
54
|
17
|
|
33
|
|
|
65
|
$self->{warner} ||= Astro::App::Satpass2::Warner->new(); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
defined $self->{generate} |
|
57
|
|
|
|
|
|
|
and CODE_REF ne ref $self->{generate} |
|
58
|
17
|
50
|
33
|
|
|
92
|
and $self->wail( q{If specified, 'generate' must be a code ref} ); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
defined $self->{name} |
|
61
|
17
|
50
|
|
|
|
45
|
or $self->wail( q{Attribute 'name' is required} ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
defined $self->{parent} |
|
64
|
17
|
50
|
|
|
|
51
|
or $self->wail( q{Attribute 'parent' is required} ); |
|
65
|
17
|
50
|
|
|
|
56
|
instance( $self->{parent}, 'Astro::App::Satpass2' ) |
|
66
|
|
|
|
|
|
|
or $self->wail( q{Attribute 'parent' must be an Astro::App::Satpass2} ); |
|
67
|
17
|
|
|
|
|
65
|
weaken( $self->{parent} ); |
|
68
|
|
|
|
|
|
|
|
|
69
|
17
|
|
|
|
|
35
|
return; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub name { |
|
73
|
25
|
|
|
25
|
1
|
48
|
my ( $self ) = @_; |
|
74
|
25
|
|
|
|
|
70
|
return $self->{name}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub parent { |
|
78
|
28
|
|
|
28
|
1
|
47
|
my ( $self ) = @_; |
|
79
|
28
|
|
|
|
|
75
|
return $self->{parent}; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub wail { |
|
83
|
1
|
|
|
1
|
1
|
6
|
my ( $self, @args ) = @_; |
|
84
|
1
|
|
|
|
|
6
|
$self->warner()->wail( @args ); |
|
85
|
0
|
|
|
|
|
0
|
return; # wail() dies, but Perl::Critic does not know this. |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub warner { |
|
89
|
1
|
|
|
1
|
1
|
2
|
my ( $self ) = @_; |
|
90
|
1
|
50
|
|
|
|
4
|
ref $self |
|
91
|
|
|
|
|
|
|
or return Astro::App::Satpass2::Warner->new(); |
|
92
|
1
|
|
|
|
|
7
|
return $self->{warner}; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub weep { |
|
96
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
97
|
0
|
|
|
|
|
|
$self->warner()->weep( @args ); |
|
98
|
0
|
|
|
|
|
|
return; # weep() dies, but Perl::Critic does not know this. |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub whinge { |
|
102
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
103
|
0
|
|
|
|
|
|
$self->warner()->whinge( @args ); |
|
104
|
0
|
|
|
|
|
|
return; |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# TODO get rid of this when level1 support goes away. |
|
108
|
|
|
|
|
|
|
sub __level1_rewrite { |
|
109
|
0
|
|
|
0
|
|
|
return; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |