blib/lib/File/Sticker/Derive.pm

filter: Statementstmt 21.7% 5 / 23 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 14.2% 1 / 7 Podpod 100% 6 / 6 totaltotal 27.9% 12 / 43 CC 4 SCAR 14.6
CC
4
Cov
18%
new
6.0
init
6.0
name
6.0
CRAP 4.3
« blib/lib/File/Sticker/Derive/Title.pm ↑ Summary Build »
1 package File::Sticker::Derive;
2 3 $File::Sticker::Derive::VERSION = '4.605';
3 =head1 NAME
4  
5 File::Sticker::Derive - derive values from existing meta-data
6  
7 =head1 VERSION
8  
9 version 4.605
10  
11 =head1 SYNOPSIS
12  
13 use File::Sticker::Derive;
14  
15 my $deriver = File::Sticker::Derive->new(%args);
16  
17 my $derived_meta = $deriver->derive(filename=>$filename,meta=>$meta);
18  
19 =head1 DESCRIPTION
20  
21 This will derive values from existing meta-data.
22  
23 This is a plug-in, different plug-ins will do different derivations.
24  
25 =cut
26  
27 3 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 =head1 DEBUGGING
30  
31 =head2 whoami
32  
33 Used for debugging info
34  
35 =cut
36 0 ▶sub whoami { ( caller(1) )[3] }
Subroutine whoami: not called CC=1 SCAR=6.9
Pod documented
37  
38 =head1 METHODS
39  
40 =head2 new
41  
42 Create a new object, setting global values for the object.
43  
44 my $obj = File::Sticker::Derive->new();
45  
46 =cut
47  
48 sub new {
49 0 ▶ my $class = shift;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
50 0 my %parameters = (@_);
51 0 ▶ my $self = bless ({%parameters}, ref ($class) || $class);
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
52  
53 0 return ($self);
54 } # new
55  
56 =head2 init
57  
58 Initialize the object.
59  
60 $deriver->init(%args);
61  
62 =cut
63  
64 sub init {
65 0 ▶ my $self = shift;
Subroutine init: not called CC=2 SCAR=17.9
Pod documented
66 0 my %parameters = @_;
67  
68 0 foreach my $key (keys %parameters)
69 {
70 0 $self->{$key} = $parameters{$key};
71 }
72 } # init
73  
74 =head2 name
75  
76 The name of the deriver; this is basically the last component
77 of the module name. This works as either a class function or a method.
78  
79 $name = $self->name();
80  
81 $name = File::Sticker::Derive::name($class);
82  
83 =cut
84  
85 sub name {
86 0 ▶ my $class = shift;
Subroutine name: not called CC=2 SCAR=17.9
Pod documented
87
88 0 ▶ my $fullname = (ref ($class) ? ref ($class) : $class);
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
89  
90 0 my @bits = split('::', $fullname);
91 0 return pop @bits;
92 } # name
93  
94 =head2 order
95  
96 The order of this deriver, ranging from 0 to 99.
97 This makes sure that the deriver is applied in order;
98 useful because a later deriver may depend on data created
99 by an earlier deriver.
100  
101 This must be overridden by the specific deriver class.
102  
103 =cut
104  
105 sub order {
106 0 ▶ return 50;
Subroutine order: not called CC=1 SCAR=6.9
Pod documented
107 } # order
108  
109 =head2 derive
110  
111 Derive common values from the existing meta-data.
112 This is expected to update the given meta-data.
113  
114 This must be overridden by the specific deriver class.
115  
116 $deriver->derive(filename=>$filename, meta=>$meta);
117  
118 =cut
119  
120 sub derive {
121 0 ▶ my $self = shift;
Subroutine derive: not called CC=1 SCAR=6.9
Pod documented
122 0 my %args = @_;
123  
124 0 my $filename = $args{filename};
125 0 my $meta = $args{meta};
126 } # derive
127  
128 =head1 Helper Functions
129  
130 Private interface.
131  
132  
133 =head1 BUGS
134  
135 Please report any bugs or feature requests to the author.
136  
137 =cut
138  
139 3 1; # End of File::Sticker::Derive
140 __END__
« blib/lib/File/Sticker/Derive/Title.pm ↑ Summary Build »