line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2014-2016 - Giovanni Simoni |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of PFT. |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# PFT is free software: you can redistribute it and/or modify it under the |
6
|
|
|
|
|
|
|
# terms of the GNU General Public License as published by the Free |
7
|
|
|
|
|
|
|
# Software Foundation, either version 3 of the License, or (at your |
8
|
|
|
|
|
|
|
# option) any later version. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# PFT is distributed in the hope that it will be useful, but WITHOUT ANY |
11
|
|
|
|
|
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12
|
|
|
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13
|
|
|
|
|
|
|
# for more details. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License along |
16
|
|
|
|
|
|
|
# with PFT. If not, see . |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
package PFT::Content::Blob v1.4.1; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
5
|
|
1955
|
use v5.16; |
|
5
|
|
|
|
|
19
|
|
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
5
|
|
43
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
119
|
|
23
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
156
|
|
24
|
5
|
|
|
5
|
|
26
|
use utf8; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
23
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=pod |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=encoding utf8 |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 NAME |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
PFT::Content::Blob - Binary file |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use PFT::Content::Blob; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $p = PFT::Content::Blob->new({ |
39
|
|
|
|
|
|
|
tree => $tree, |
40
|
|
|
|
|
|
|
path => $path, |
41
|
|
|
|
|
|
|
relpath => ['animals', 'cats', 'meow.png'], # decoded strings |
42
|
|
|
|
|
|
|
}) |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
C is the basetype for all binary-based content files. |
47
|
|
|
|
|
|
|
It inherits from C and has two specific subtypes: |
48
|
|
|
|
|
|
|
C and C. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
5
|
|
|
5
|
|
196
|
use parent 'PFT::Content::File'; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
43
|
|
53
|
|
|
|
|
|
|
|
54
|
5
|
|
|
5
|
|
216
|
use Carp; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
717
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new { |
57
|
8
|
|
|
8
|
0
|
19
|
my $cls = shift; |
58
|
8
|
|
|
|
|
13
|
my $params = shift; |
59
|
|
|
|
|
|
|
|
60
|
8
|
|
|
|
|
35
|
my $self = $cls->SUPER::new($params); |
61
|
8
|
|
|
|
|
16
|
my $relpath = $params->{relpath}; |
62
|
8
|
50
|
|
|
|
25
|
confess 'Invalid relpath' unless ref $relpath eq 'ARRAY'; |
63
|
8
|
|
|
|
|
14
|
$self->{relpath} = $relpath; |
64
|
8
|
|
|
|
|
57
|
$self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 Properties |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item relpath |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Relative path in form of a list. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
A good use for it could be, concatenating it using File::Spec->catfile. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub relpath { |
80
|
4
|
|
|
4
|
1
|
7
|
@{shift->{relpath}} |
|
4
|
|
|
|
|
38
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1 |