FormHandler/Moose.pm

filter: Statementstmt 100% 40 / 40 Branchbran 87.5% 7 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 5 totaltotal 91.1% 62 / 68 CC 8 SCAR 11.4
CC
8
Cov
98%
has_field
6.0
has_page
3.1
BEGIN
1.0
CRAP 3.1
« FormHandler/Field/Compound.pm ↑ Summary FormHandler/Widget/ApplyRole.pm »
1 package HTML::FormHandler::Moose;
2 # ABSTRACT: to add FormHandler sugar
3 149 $HTML::FormHandler::Moose::VERSION = '0.410002';
4 149 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 149 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 149 ▶use Moose::Util::MetaRole;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 149 ▶use HTML::FormHandler::Meta::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 149 Moose::Exporter->setup_import_methods(
11 with_meta => [ 'has_field', 'has_page', 'has_block', 'apply' ],
12 also => 'Moose',
13 );
14  
15 453 ▶sub init_meta {
Subroutine init_meta: called CC=1 SCAR=0.0
Pod undocumented
16 453 my $class = shift;
17  
18 453 my %options = @_;
19 453 Moose->init_meta(%options);
20 my $meta = Moose::Util::MetaRole::apply_metaroles(
21 for => $options{for_class},
22 453 class_metaroles => {
23 class => [ 'HTML::FormHandler::Meta::Role' ]
24 }
25 );
26 453 return $meta;
27 }
28  
29 848 ▶sub has_field {
Subroutine has_field: called CC=6 SCAR=17.9
Pod undocumented
30 848 my ( $meta, $name, %options ) = @_;
31 848 ▶ my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
Branch: 1 branch
BranchTrueFalseTotal
ref $name eq 'ARRAY' ? : 1 847 848
32  
33 848 ▶ unless ($meta->found_hfh) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($meta->found_hfh) 229 619 848
34 229 my @linearized_isa = $meta->linearized_isa;
35 229 ▶ if( grep { $_ eq 'HTML::FormHandler' || $_ eq 'HTML::FormHandler::Field' } @linearized_isa ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq 'HTML::FormHandler' or $_ eq 'HTML::FormHandler::Field';} @linearized_isa) { } 228 1 229
Condition100%3/3
$_ eq 'HTML::FormHandler' || $_ eq 'HTML::FormHandler::Field'
l!l&&r!l&&!r
21513692
MC/DC100%2/2
$_ eq 'HTML::FormHandler' || $_ eq 'HTML::FormHandler::Field'
$_ eq 'HTML::FormHandler' $_ eq 'HTML::FormHandler::Field'
Truth table100%3/3
A || B
A= $_ eq 'HTML::FormHandler'B= $_ eq 'HTML::FormHandler::Field'
ABresult
1X1
011
000
36 228 $meta->found_hfh(1);
37 }
38 else {
39 1 die "Package '" . $linearized_isa[0] . "' uses HTML::FormHandler::Moose without extending HTML::FormHandler[::Field]";
40 }
41 }
42  
43 847 $meta->add_to_field_list( { name => $_, %options } ) for @$names;
44 }
45  
46 3 ▶sub has_page {
Subroutine has_page: called CC=3 SCAR=11.2
Pod undocumented
47 3 my ( $meta, $name, %options ) = @_;
48 3 ▶ my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ];
Branch: 1 branch
BranchTrueFalseTotal
ref $name eq 'ARRAY' ? : 0 3 3
49  
50 3 $meta->add_to_page_list( { name => $_, %options } ) for @$names;
51 }
52  
53 13 ▶sub has_block {
Subroutine has_block: called CC=1 SCAR=0.0
Pod undocumented
54 13 my ( $meta, $name, %options ) = @_;
55 13 $meta->add_to_block_list( { name => $name, %options } );
56 }
57  
58 23 ▶sub apply {
Subroutine apply: called CC=1 SCAR=0.0
Pod undocumented
59 23 my ( $meta, $arrayref ) = @_;
60  
61 23 $meta->add_to_apply_list( @{$arrayref} );
62 }
63  
64 149 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 149 1;
66  
67 __END__
« FormHandler/Field/Compound.pm ↑ Summary FormHandler/Widget/ApplyRole.pm »