Chloro.pm

filter: Statementstmt 100% 50 / 50 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 0.0% 0 / 3 totaltotal 95.8% 69 / 72 CC 4 SCAR 3.2
CC
4
Cov
100%
init_meta
2.0
field
2.0
group
2.0
CRAP 1.4
« Chloro/Result/Field.pm ↑ Summary Chloro/Result/Group.pm »
1 package Chloro;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 our $VERSION = '0.07';
8  
9 11 ▶use Chloro::Field;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use Chloro::Group;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use Chloro::Role::Form;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶use Chloro::Trait::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 11 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 11 ▶use Moose::Util::MetaRole;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 11 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 11 Moose::Exporter->setup_import_methods(
18 with_meta => [qw( field group )],
19 );
20  
21 17 ▶sub init_meta {
Subroutine init_meta: called CC=2 SCAR=6.9
Pod undocumented
22 17 shift;
23 17 my %p = @_;
24  
25 Moose::Util::MetaRole::apply_metaroles(
26 for => $p{for_class},
27 17 class_metaroles => { class => ['Chloro::Trait::Class'] },
28 role_metaroles => {
29 role => ['Chloro::Trait::Role'],
30 application_to_class => ['Chloro::Trait::Application::ToClass'],
31 application_to_role => ['Chloro::Trait::Application::ToRole'],
32 },
33 );
34  
35 17 ▶ if ( Class::MOP::class_of( $p{for_class} )->isa('Moose::Meta::Class') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (Class::MOP::class_of($p{"for_class"})->isa("Moose::Meta::Class")) 15 2 17
36 Moose::Util::MetaRole::apply_base_class_roles(
37 for => $p{for_class},
38 15 roles => ['Chloro::Role::Form'],
39 );
40 }
41  
42 17 return;
43 }
44  
45 35 ▶sub field {
Subroutine field: called CC=2 SCAR=6.9
Pod undocumented
46 35 my $meta = shift;
47  
48 35 my $field = $meta->_make_field(@_);
49  
50 # Called inside a call to group()
51 35 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 12 23 35
52 12 return $field;
53 }
54 else {
55 23 $meta->add_field($field);
56 }
57  
58 23 return;
59 }
60  
61 6 ▶sub group {
Subroutine group: called CC=2 SCAR=6.9
Pod undocumented
62 6 my $meta = shift;
63  
64 6 my @fields;
65 6 ▶ push @fields, pop @_ while blessed $_[-1];
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($_[-1]) and do { push @fields, pop @_ } 12 6 18
66  
67 6 my $group = Chloro::Group->new(
68 name => shift,
69 fields => \@fields,
70 @_,
71 );
72  
73 6 $meta->add_group($group);
74 }
75  
76 11 1;
77  
78 # ABSTRACT: Form Processing So Easy It Will Knock You Out
79  
80 __END__
« Chloro/Result/Field.pm ↑ Summary Chloro/Result/Group.pm »