line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Embed; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Data::Embed::VERSION = '0.2_03'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: embed arbitrary data in a file |
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
150986
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
316
|
|
9
|
8
|
|
|
8
|
|
33
|
use warnings; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
179
|
|
10
|
8
|
|
|
8
|
|
3647
|
use English qw< -no_match_vars >; |
|
8
|
|
|
|
|
23810
|
|
|
8
|
|
|
|
|
40
|
|
11
|
8
|
|
|
8
|
|
2487
|
use Exporter qw< import >; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
193
|
|
12
|
8
|
|
|
8
|
|
4739
|
use Log::Log4perl::Tiny qw< :easy :dead_if_first >; |
|
8
|
|
|
|
|
40399
|
|
|
8
|
|
|
|
|
37
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = |
15
|
|
|
|
|
|
|
qw< writer reader embed embedded generate_module_from_file >; |
16
|
|
|
|
|
|
|
our @EXPORT = (); |
17
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
18
|
|
|
|
|
|
|
all => \@EXPORT_OK, |
19
|
|
|
|
|
|
|
reading => [qw< reader embedded >], |
20
|
|
|
|
|
|
|
writing => [qw< writer embed generate_module_from_file >], |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub writer { |
25
|
55
|
|
|
55
|
1
|
42313
|
require Data::Embed::Writer; |
26
|
55
|
|
|
|
|
476
|
return Data::Embed::Writer->new(@_); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub reader { |
30
|
1
|
|
|
1
|
1
|
7
|
require Data::Embed::Reader; |
31
|
1
|
|
|
|
|
6
|
return Data::Embed::Reader->new(@_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub embed { |
35
|
2
|
50
|
33
|
2
|
1
|
485
|
my %args = (@_ && ref($_[0])) ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
13
|
my %constructor_args = |
38
|
2
|
|
|
|
|
5
|
map { $_ => delete $args{$_} } qw< input output >; |
39
|
2
|
100
|
|
|
|
10
|
$constructor_args{input} = $constructor_args{output} = |
40
|
|
|
|
|
|
|
delete $args{container} |
41
|
|
|
|
|
|
|
if exists $args{container}; |
42
|
2
|
50
|
|
|
|
10
|
my $writer = writer(%constructor_args) |
43
|
|
|
|
|
|
|
or LOGCROAK 'could not get the writer object'; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
7
|
return $writer->add(%args); |
46
|
|
|
|
|
|
|
} ## end sub embed |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub embedded { |
49
|
1
|
50
|
|
1
|
1
|
1399
|
my $reader = reader(shift) |
50
|
|
|
|
|
|
|
or LOGCROAK 'could not get the writer object'; |
51
|
1
|
|
|
|
|
4
|
return $reader->files(); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub generate_module_from_file { |
55
|
0
|
|
|
0
|
1
|
|
require Data::Embed::OneFileAsModule; |
56
|
0
|
|
|
|
|
|
goto &Data::Embed::OneFileAsModule::generate_module_from_file; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |