line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::PrettyPipe::Format; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Format role |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
## no critic (ProhibitAccessOfPrivateData) |
6
|
|
|
|
|
|
|
|
7
|
17
|
|
|
17
|
|
159779
|
use Try::Tiny; |
|
17
|
|
|
|
|
49
|
|
|
17
|
|
|
|
|
1063
|
|
8
|
17
|
|
|
17
|
|
2549
|
use Module::Load; |
|
17
|
|
|
|
|
5714
|
|
|
17
|
|
|
|
|
144
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
17
|
|
|
17
|
|
891
|
use Moo::Role; |
|
17
|
|
|
|
|
37
|
|
|
17
|
|
|
|
|
107
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.11'; # TRIAL |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'MooX::Attributes::Shadow::Role'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
requires 'copy_into'; |
17
|
|
|
|
|
|
|
|
18
|
17
|
|
|
17
|
|
6999
|
use namespace::clean; |
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
130
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# IS THIS REALLY NEEDED????? this will convert an attribute with a |
21
|
|
|
|
|
|
|
# an undef value into a switch. |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# undefined values are the same as not specifying a value at all |
24
|
|
|
|
|
|
|
if ( 0 ) { |
25
|
|
|
|
|
|
|
around BUILDARGS => sub { |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my ( $orig, $class ) = ( shift, shift ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $attrs = $class->$orig( @_ ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
delete @{$attrs}{ grep { !defined $attrs->{$_} } keys %$attrs }; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return $attrs; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _copy_attrs { |
38
|
|
|
|
|
|
|
|
39
|
1368
|
|
|
1368
|
|
2951
|
my ( $from, $to ) = ( shift, shift ); |
40
|
|
|
|
|
|
|
|
41
|
1368
|
|
|
|
|
2853
|
for my $attr ( @_ ) { |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
2736
|
100
|
|
|
|
5924
|
next unless $from->${ \"has_$attr" }; |
|
2736
|
|
|
|
|
11201
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
try { |
47
|
176
|
50
|
|
176
|
|
10438
|
if ( defined( my $value = $from->$attr ) ) { |
48
|
|
|
|
|
|
|
|
49
|
176
|
|
|
|
|
3574
|
$to->$attr( $value ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
else { |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
$to->${ \"clear_$attr" }; |
|
0
|
|
|
|
|
0
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
catch { |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
|
0
|
croak( |
62
|
|
|
|
|
|
|
"unable to copy into or clear attribute $attr in object of type ", |
63
|
|
|
|
|
|
|
ref $to, |
64
|
|
|
|
|
|
|
": $_\n" |
65
|
|
|
|
|
|
|
); |
66
|
176
|
|
|
|
|
1169
|
}; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
1368
|
|
|
|
|
7605
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub copy_from { |
84
|
|
|
|
|
|
|
|
85
|
435
|
|
|
435
|
1
|
7066
|
$_[1]->copy_into( $_[0] ); |
86
|
|
|
|
|
|
|
|
87
|
435
|
|
|
|
|
1007
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub clone { |
99
|
|
|
|
|
|
|
|
100
|
907
|
|
|
907
|
1
|
21808
|
my $class = ref( $_[0] ); |
101
|
907
|
|
|
|
|
3038
|
load $class; |
102
|
|
|
|
|
|
|
|
103
|
907
|
|
|
|
|
71302
|
my $clone = $class->new; |
104
|
|
|
|
|
|
|
|
105
|
907
|
|
|
|
|
15250
|
$_[0]->copy_into( $clone ); |
106
|
|
|
|
|
|
|
|
107
|
907
|
|
|
|
|
3438
|
return $clone; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub new_from_attrs { |
120
|
|
|
|
|
|
|
|
121
|
37
|
|
|
37
|
1
|
91
|
my $class = shift; |
122
|
37
|
|
|
|
|
166
|
load $class; |
123
|
|
|
|
|
|
|
|
124
|
37
|
|
|
|
|
3019
|
return $class->new( $class->xtract_attrs( @_ ) ); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub new_from_hash { |
140
|
|
|
|
|
|
|
|
141
|
258
|
|
|
258
|
1
|
656
|
my $contained = shift; |
142
|
258
|
|
|
|
|
495
|
my $hash = pop; |
143
|
|
|
|
|
|
|
|
144
|
258
|
|
33
|
|
|
1373
|
my $container = shift || caller(); |
145
|
|
|
|
|
|
|
|
146
|
258
|
|
|
|
|
1210
|
load $contained; |
147
|
|
|
|
|
|
|
|
148
|
258
|
|
|
|
|
19277
|
my $shadowed = $contained->shadowed_attrs( $container ); |
149
|
|
|
|
|
|
|
|
150
|
258
|
|
|
|
|
9126
|
my %attr; |
151
|
258
|
|
|
|
|
504
|
while ( my ( $alias, $orig ) = each %{$shadowed} ) { |
|
774
|
|
|
|
|
2646
|
|
152
|
|
|
|
|
|
|
|
153
|
516
|
50
|
|
|
|
1397
|
$attr{$orig} = $hash->{$alias} if exists $hash->{$alias}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
258
|
|
|
|
|
7491
|
return $contained->new( \%attr ); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# |
163
|
|
|
|
|
|
|
# This file is part of IPC-PrettyPipe |
164
|
|
|
|
|
|
|
# |
165
|
|
|
|
|
|
|
# This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory. |
166
|
|
|
|
|
|
|
# |
167
|
|
|
|
|
|
|
# This is free software, licensed under: |
168
|
|
|
|
|
|
|
# |
169
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
170
|
|
|
|
|
|
|
# |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
__END__ |