lib/HTML/FormFu/Processor.pm

filter: Statementstmt 86.1% 31 / 36 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 79.2% 42 / 53 SCAR 16.5
CC
5
Cov
80%
localize_args
7.7
BEGIN
1.0
BEGIN
1.0
CRAP 5.2
« lib/HTML/FormFu/Role/Filter/Compound.pm ↑ Summary lib/HTML/FormFu/Filter/CopyValue.pm »
1 404 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Processor;
4 404 $HTML::FormFu::Processor::VERSION = '2.06';
5 # ABSTRACT: base class for constraints
6  
7 404 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 404 ▶use MooseX::Attribute::Chained;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 404 with 'HTML::FormFu::Role::NestedHashUtils',
11 'HTML::FormFu::Role::HasParent',
12 'HTML::FormFu::Role::Populate';
13  
14 404 use HTML::FormFu::Attribute qw(
15 mk_output_accessors
16 mk_inherited_accessors
17 404 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 404 use HTML::FormFu::ObjectUtil qw(
19 form
20 name nested_name
21 404 ▶ nested_names parent );
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 404 has type => ( is => 'rw', traits => ['Chained'] );
24  
25 404 __PACKAGE__->mk_output_accessors(qw( message ));
26  
27 404 __PACKAGE__->mk_inherited_accessors(qw( locale ));
28  
29 404 *field = \&parent;
30  
31 sub localize_args {
32 40 ▶ my $self = shift;
Subroutine localize_args: called CC=5 SCAR=20.4
Pod undocumented
33  
34 40 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 40 40
35  
36 # user's passing their own args - save them
37 0 ▶ if ( @_ == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 0 0 0
38 0 $self->{localize_args} = $_[0];
39 }
40 else {
41 0 $self->{localize_args} = [@_];
42 }
43 0 return $self;
44 }
45  
46 # if the user passed a value, use that - even if it's undef
47 40 ▶ if ( exists $self->{localize_args} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"localize_args"}) 0 40 40
48 0 return $self->{localize_args};
49 }
50  
51 # do we have a method to build our own args?
52 40 ▶ if ( my $method = $self->can('_localize_args') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $method = $self->can("_localize_args")) 6 34 40
53 6 return $self->$method;
54 }
55  
56 34 return;
57 }
58  
59 sub clone {
60 53 ▶ my ($self) = @_;
Subroutine clone: called CC=1 SCAR=0.0
Pod undocumented
61  
62 53 my %new = %$self;
63  
64 53 return bless \%new, ref $self;
65 }
66  
67 404 1;
68  
69 __END__
70  
71 =pod
72  
73 =encoding UTF-8
74  
75 =head1 NAME
76  
77 HTML::FormFu::Processor - base class for constraints
78  
79 =head1 VERSION
80  
81 version 2.06
82  
83 =head1 AUTHOR
84  
85 Carl Franks, C<cfranks@cpan.org>
86  
87 =head1 LICENSE
88  
89 This library is free software, you can redistribute it and/or modify it under
90 the same terms as Perl itself.
91  
92 =head1 AUTHOR
93  
94 Carl Franks <cpan@fireartist.com>
95  
96 =head1 COPYRIGHT AND LICENSE
97  
98 This software is copyright (c) 2018 by Carl Franks.
99  
100 This is free software; you can redistribute it and/or modify it under
101 the same terms as the Perl 5 programming language system itself.
102  
103 =cut
« lib/HTML/FormFu/Role/Filter/Compound.pm ↑ Summary lib/HTML/FormFu/Filter/CopyValue.pm »