line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hades::Realm::Import::Export; |
2
|
6
|
|
|
6
|
|
1870747
|
use strict; |
|
6
|
|
|
|
|
56
|
|
|
6
|
|
|
|
|
188
|
|
3
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
208
|
|
4
|
6
|
|
|
6
|
|
34
|
use base qw/Hades::Realm::Exporter/; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
3564
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.03; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
9
|
100
|
|
9
|
1
|
10177
|
my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ ); |
|
8
|
|
|
|
|
49
|
|
9
|
9
|
|
|
|
|
64
|
my $self = $cls->SUPER::new(%args); |
10
|
9
|
|
|
|
|
418
|
my %accessors = (); |
11
|
9
|
|
|
|
|
23
|
for my $accessor ( keys %accessors ) { |
12
|
|
|
|
|
|
|
my $value |
13
|
|
|
|
|
|
|
= $self->$accessor( |
14
|
|
|
|
|
|
|
defined $args{$accessor} |
15
|
|
|
|
|
|
|
? $args{$accessor} |
16
|
0
|
0
|
|
|
|
0
|
: $accessors{$accessor}->{default} ); |
17
|
0
|
0
|
0
|
|
|
0
|
unless ( !$accessors{$accessor}->{required} || defined $value ) { |
18
|
0
|
|
|
|
|
0
|
die "$accessor accessor is required"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
9
|
|
|
|
|
46
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub build_new { |
25
|
5
|
|
|
5
|
1
|
96286
|
my ( $orig, $self, @params ) = ( 'SUPER::build_new', @_ ); |
26
|
|
|
|
|
|
|
|
27
|
5
|
|
|
|
|
40
|
my @res = $self->$orig( @params, q|%EX| ); |
28
|
|
|
|
|
|
|
|
29
|
5
|
50
|
|
|
|
219
|
return wantarray ? @res : $res[0]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub build_exporter { |
33
|
13
|
|
|
13
|
1
|
7233
|
my ( $self, $begin, $mg, $export, $meta ) = @_; |
34
|
13
|
100
|
66
|
|
|
96
|
if ( !defined($begin) || ref $begin ) { |
35
|
2
|
50
|
|
|
|
6
|
$begin = defined $begin ? $begin : 'undef'; |
36
|
2
|
|
|
|
|
21
|
die |
37
|
|
|
|
|
|
|
qq{Str: invalid value $begin for variable \$begin in method build_exporter}; |
38
|
|
|
|
|
|
|
} |
39
|
11
|
100
|
100
|
|
|
79
|
if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) { |
40
|
2
|
50
|
|
|
|
7
|
$mg = defined $mg ? $mg : 'undef'; |
41
|
2
|
|
|
|
|
20
|
die |
42
|
|
|
|
|
|
|
qq{Object: invalid value $mg for variable \$mg in method build_exporter}; |
43
|
|
|
|
|
|
|
} |
44
|
9
|
100
|
100
|
|
|
46
|
if ( ( ref($export) || "" ) ne "HASH" ) { |
45
|
2
|
50
|
|
|
|
7
|
$export = defined $export ? $export : 'undef'; |
46
|
2
|
|
|
|
|
19
|
die |
47
|
|
|
|
|
|
|
qq{HashRef: invalid value $export for variable \$export in method build_exporter}; |
48
|
|
|
|
|
|
|
} |
49
|
7
|
100
|
100
|
|
|
39
|
if ( ( ref($meta) || "" ) ne "HASH" ) { |
50
|
2
|
50
|
|
|
|
6
|
$meta = defined $meta ? $meta : 'undef'; |
51
|
2
|
|
|
|
|
19
|
die |
52
|
|
|
|
|
|
|
qq{HashRef: invalid value $meta for variable \$meta in method build_exporter}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
5
|
|
|
|
|
13
|
my %ex = (); |
56
|
5
|
|
|
|
|
90
|
for my $k ( keys %{$export} ) { |
|
5
|
|
|
|
|
20
|
|
57
|
27
|
|
|
|
|
38
|
push @{ $ex{$_} }, $k for ( @{ $export->{$k} } ); |
|
27
|
|
|
|
|
54
|
|
|
147
|
|
|
|
|
279
|
|
58
|
|
|
|
|
|
|
} |
59
|
5
|
|
|
|
|
29
|
my $ex_tags = Module::Generate::_stringify_struct( 'undefined', \%ex ); |
60
|
5
|
|
|
|
|
14159
|
$ex_tags =~ s/^{/(/; |
61
|
5
|
|
|
|
|
33
|
$ex_tags =~ s/}$/);/; |
62
|
5
|
|
|
|
|
54
|
$begin = '%EX = ' . $ex_tags . $begin; |
63
|
5
|
|
|
|
|
50
|
return $begin; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub after_class { |
68
|
7
|
|
|
7
|
1
|
661
|
my ( $self, $mg ) = @_; |
69
|
7
|
100
|
100
|
|
|
72
|
if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) { |
70
|
2
|
50
|
|
|
|
6
|
$mg = defined $mg ? $mg : 'undef'; |
71
|
2
|
|
|
|
|
20
|
die |
72
|
|
|
|
|
|
|
qq{Object: invalid value $mg for variable \$mg in method after_class}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
5
|
|
|
|
|
31
|
$mg->base(q|Import::Export|); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Hades::Realm::Import::Export - Hades realm for Import::Export |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 VERSION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Version 0.01 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SYNOPSIS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Quick summary of what the module does: |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Hades->run({ |
98
|
|
|
|
|
|
|
eval => 'Kosmos { |
99
|
|
|
|
|
|
|
[curae penthos] :t(Int) :d(2) :p :pr :c :r :i(1, GROUP) |
100
|
|
|
|
|
|
|
geras $nosoi :t(Int) :d(5) :i { if (£penthos == $nosoi) { return £curae; } } |
101
|
|
|
|
|
|
|
}', |
102
|
|
|
|
|
|
|
realm => 'Import::Export', |
103
|
|
|
|
|
|
|
}); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
... generates ... |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
package Kosmos; |
108
|
|
|
|
|
|
|
use strict; |
109
|
|
|
|
|
|
|
use warnings; |
110
|
|
|
|
|
|
|
use base qw/Import::Export/; |
111
|
|
|
|
|
|
|
our $VERSION = 0.01; |
112
|
|
|
|
|
|
|
our ( %EX, %ACCESSORS ); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
BEGIN { |
115
|
|
|
|
|
|
|
%EX = ( |
116
|
|
|
|
|
|
|
'curae' => [ 'EXPORT', 'EXPORT_OK', 'ACCESSORS', 'GROUP' ], |
117
|
|
|
|
|
|
|
'clear_penthos' => [ 'EXPORT', 'EXPORT_OK', 'CLEARERS' ], |
118
|
|
|
|
|
|
|
'penthos' => [ 'EXPORT', 'EXPORT_OK', 'ACCESSORS', 'GROUP' ], |
119
|
|
|
|
|
|
|
'geras' => [ 'EXPORT_OK', 'METHODS' ], |
120
|
|
|
|
|
|
|
'has_curae' => [ 'EXPORT', 'EXPORT_OK', 'PREDICATES' ], |
121
|
|
|
|
|
|
|
'has_penthos' => [ 'EXPORT', 'EXPORT_OK', 'PREDICATES' ], |
122
|
|
|
|
|
|
|
'clear_curae' => [ 'EXPORT', 'EXPORT_OK', 'CLEARERS' ] |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
%ACCESSORS = ( curae => 2, penthos => 2, ); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub curae { |
128
|
|
|
|
|
|
|
my ($value) = @_; |
129
|
|
|
|
|
|
|
my $private_caller = caller(); |
130
|
|
|
|
|
|
|
if ( $private_caller ne __PACKAGE__ ) { |
131
|
|
|
|
|
|
|
die "cannot call private method curae from $private_caller"; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
if ( defined $value ) { |
134
|
|
|
|
|
|
|
if ( ref $value || $value !~ m/^[-+\d]\d*$/ ) { |
135
|
|
|
|
|
|
|
die qq{Int: invalid value $value for accessor curae}; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
$ACCESSORS{curae} = $value; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
return $ACCESSORS{curae}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub has_curae { |
143
|
|
|
|
|
|
|
return exists $ACCESSORS{curae}; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub clear_curae { |
147
|
|
|
|
|
|
|
delete $ACCESSORS{curae}; |
148
|
|
|
|
|
|
|
return 1; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub penthos { |
152
|
|
|
|
|
|
|
my ($value) = @_; |
153
|
|
|
|
|
|
|
my $private_caller = caller(); |
154
|
|
|
|
|
|
|
if ( $private_caller ne __PACKAGE__ ) { |
155
|
|
|
|
|
|
|
die "cannot call private method penthos from $private_caller"; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
if ( defined $value ) { |
158
|
|
|
|
|
|
|
if ( ref $value || $value !~ m/^[-+\d]\d*$/ ) { |
159
|
|
|
|
|
|
|
die qq{Int: invalid value $value for accessor penthos}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
$ACCESSORS{penthos} = $value; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
return $ACCESSORS{penthos}; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub has_penthos { |
167
|
|
|
|
|
|
|
return exists $ACCESSORS{penthos}; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub clear_penthos { |
171
|
|
|
|
|
|
|
delete $ACCESSORS{penthos}; |
172
|
|
|
|
|
|
|
return 1; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub geras { |
176
|
|
|
|
|
|
|
my ($nosoi) = @_; |
177
|
|
|
|
|
|
|
$nosoi = defined $nosoi ? $nosoi : 5; |
178
|
|
|
|
|
|
|
if ( !defined($nosoi) || ref $nosoi || $nosoi !~ m/^[-+\d]\d*$/ ) { |
179
|
|
|
|
|
|
|
$nosoi = defined $nosoi ? $nosoi : 'undef'; |
180
|
|
|
|
|
|
|
die |
181
|
|
|
|
|
|
|
qq{Int: invalid value $nosoi for variable \$nosoi in method geras}; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
if ( penthos() == $nosoi ) { return curae(); } |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
__END__ |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 new |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Instantiate a new Hades::Realm::Import::Export object. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Hades::Realm::Import::Export->new |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 build_new |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
call build_new method. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 build_exporter |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
call build_exporter method. Expects param $begin to be a Str, param $mg to be a Object, param $export to be a HashRef, param $meta to be a HashRef. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
$obj->build_exporter($begin, $mg, $export, $meta) |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 after_class |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
call after_class method. Expects param $mg to be a Object. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
$obj->after_class($mg) |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head1 AUTHOR |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
LNATION, C<< <email at lnation.org> >> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 BUGS |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Please report any bugs or feature requests to C<bug-hades::realm::import::export at rt.cpan.org>, or through |
221
|
|
|
|
|
|
|
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Realm-Import-Export>. I will be notified, and then you'll |
222
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 SUPPORT |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
perldoc Hades::Realm::Import::Export |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
You can also look for information at: |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=over 4 |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Realm-Import-Export> |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
L<http://annocpan.org/dist/Hades-Realm-Import-Export> |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item * CPAN Ratings |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
L<https://cpanratings.perl.org/d/Hades-Realm-Import-Export> |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=item * Search CPAN |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
L<https://metacpan.org/release/Hades-Realm-Import-Export> |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=back |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by LNATION. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
This is free software, licensed under: |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|