lib/Templer/Site/Asset.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 85.1% 23 / 27 CC 3 SCAR 7.1
CC
3
Cov
89%
new
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« lib/Templer/Plugin/ShellCommand.pm ↑ Summary blib/lib/App/Templer.pm »
1  
2 =head1 NAME
3  
4 Templer::Site::Asset - An interface to a site asset.
5  
6 =cut
7  
8 =head1 SYNOPSIS
9  
10 use strict;
11 use warnings;
12  
13 use Templer::Site::Asset;
14  
15 my $page = Templer::Site::Asset->new( file => "./input/robots.txt" );
16  
17 =cut
18  
19 =head1 DESCRIPTION
20  
21 An asset is anything beneath the input directory which is *not* a page.
22  
23 Assuming we're not running in "in-place" mode then assets are copied
24 over to a suitable filename in the output tree.
25  
26 In C<templer> the page objects are created by the L<Templer::Site> module.
27  
28 =cut
29  
30 =head1 LICENSE
31  
32 This module is free software; you can redistribute it and/or modify it
33 under the terms of either:
34  
35 a) the GNU General Public License as published by the Free Software
36 Foundation; either version 2, or (at your option) any later version,
37 or
38  
39 b) the Perl "Artistic License".
40  
41 =cut
42  
43 =head1 AUTHOR
44  
45 Steve Kemp <steve@steve.org.uk>
46  
47 =cut
48  
49 =head1 COPYRIGHT AND LICENSE
50  
51 Copyright (C) 2012-2015 Steve Kemp <steve@steve.org.uk>.
52  
53 This library is free software. You can modify and or distribute it under
54 the same terms as Perl itself.
55  
56 =cut
57  
58 =head1 METHODS
59  
60 =cut
61  
62  
63  
64 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
66  
67  
68 package Templer::Site::Asset;
69  
70  
71  
72 =head2 new
73  
74 The constructor.
75  
76 The single appropriate argument is the hash-key "file", pointing to the
77 file on-disk.
78  
79 =cut
80  
81 sub new
82 15 ▶{
Subroutine new: called CC=3 SCAR=11.2
Pod documented
83 15 my ( $proto, %supplied ) = (@_);
84 15 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
0150
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
85  
86 15 my $self = {};
87  
88 #
89 # Allow user supplied values to override our defaults
90 #
91 15 foreach my $key ( keys %supplied )
92 {
93 15 $self->{ lc $key } = $supplied{ $key };
94 }
95  
96 15 bless( $self, $class );
97 15 return $self;
98 }
99  
100  
101 =head2 source
102  
103 Return the filename we were built from. This is the value passed
104 in the constructor.
105  
106 =cut
107  
108 sub source
109 25 ▶{
Subroutine source: called CC=1 SCAR=0.0
Pod documented
110 25 my ($self) = (@_);
111 25 $self->{ "file" };
112 }
113  
114  
115  
116 11 1;
« lib/Templer/Plugin/ShellCommand.pm ↑ Summary blib/lib/App/Templer.pm »