Muster/Hook.pm

filter: Statementstmt 45.8% 11 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 51.5% 17 / 33 CC 1 SCAR 4.1
CC
1
Cov
46%
register
2.0
register_filter
2.0
process
2.0
CRAP 1.5
« Muster/Generator.pm ↑ Summary Muster/Command/init.pm »
1 package Muster::Hook;
2 25 $Muster::Hook::VERSION = '0.96';
3 25 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use Muster::LeafFile;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 25 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =encoding utf8
9  
10 =head1 NAME
11  
12 Muster::Hook - Muster hook base class
13  
14 =head1 VERSION
15  
16 version 0.96
17  
18 =head1 SYNOPSIS
19  
20 # CamelCase plugin name
21 package Muster::Hook::MyHook;
22 use Mojo::Base 'Muster::Hook';
23  
24 sub register {
25 my $self = shift;
26 my $hookmaster = shift;
27 my $conf = $shift;
28  
29 return $self;
30 }
31  
32 sub process {
33 my $self = shift;
34 my %args = @_;
35  
36 # Magic here! :)
37  
38 return $leaf;
39 }
40  
41 =head1 DESCRIPTION
42  
43 L<Muster::Hook> is an abstract base class for L<Muster> hooks.
44  
45 A hook will be used in both the scanning phase and the assembly phase, so it needs to be told which it is.
46  
47 =head1 METHODS
48  
49 L<Muster::Hook> inherits all methods from L<Mojo::Base> and implements
50 the following new ones.
51  
52 =head2 register
53  
54 Initialize, and register hooks.
55  
56 =cut
57 0 ▶sub register {
Subroutine register: not called CC=1 SCAR=6.9
Pod documented
58 0 my $self = shift;
59 0 my $hookmaster = shift;
60 0 my $conf = shift;
61  
62 0 return $self;
63 } # register
64  
65 =head2 register_filter
66  
67 Initialize, and register HTML-filters.
68  
69 =cut
70 0 ▶sub register_filter {
Subroutine register_filter: not called CC=1 SCAR=6.9
Pod documented
71 0 my $self = shift;
72 0 my $hookmaster = shift;
73 0 my $conf = shift;
74  
75 0 return $self;
76 } # register_filter
77  
78 =head2 process
79  
80 Process (scan or modify) a leaf object. In scanning phase, it may update the
81 meta-data, in modify phase, it may update the content. May leave the leaf
82 untouched.
83  
84 my $new_leaf = $self->process(leaf=>$leaf,phase=>$phase);
85  
86 =cut
87  
88 0 ▶sub process {
Subroutine process: not called CC=1 SCAR=6.9
Pod documented
89 0 my $self = shift;
90 0 my %args = @_;
91  
92 0 my $leaf = $args{leaf};
93 0 my $phase = $args{phase};
94  
95 0 return $leaf;
96 }
97  
98 25 1;
« Muster/Generator.pm ↑ Summary Muster/Command/init.pm »