| 1 | 452 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | package HTML::FormFu::Processor; | ||||||||||
| 4 | 452 | $HTML::FormFu::Processor::VERSION = '2.09'; | |||||||||
| 5 | # ABSTRACT: base class for constraints | ||||||||||
| 6 | |||||||||||
| 7 | 452 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 452 | ▶ | use MooseX::Attribute::Chained; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 452 | with 'HTML::FormFu::Role::NestedHashUtils', | |||||||||
| 11 | 'HTML::FormFu::Role::HasParent', | ||||||||||
| 12 | 'HTML::FormFu::Role::Populate'; | ||||||||||
| 13 | |||||||||||
| 14 | 452 | ▶ | use HTML::FormFu::Attribute qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | mk_output_accessors | ||||||||||
| 16 | mk_inherited_accessors | ||||||||||
| 17 | 452 | ); | |||||||||
| 18 | 452 | ▶ | use HTML::FormFu::ObjectUtil qw( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | form | ||||||||||
| 20 | name nested_name | ||||||||||
| 21 | 452 | nested_names parent ); | |||||||||
| 22 | |||||||||||
| 23 | 452 | has type => ( is => 'rw', traits => ['Chained'] ); | |||||||||
| 24 | |||||||||||
| 25 | 452 | __PACKAGE__->mk_output_accessors(qw( message )); | |||||||||
| 26 | |||||||||||
| 27 | 452 | __PACKAGE__->mk_inherited_accessors(qw( locale )); | |||||||||
| 28 | |||||||||||
| 29 | 452 | *field = \&parent; | |||||||||
| 30 | |||||||||||
| 31 | 40 | ▶ | sub localize_args { | ||||||||
|
Subroutine
localize_args: called CC=5 SCAR=20.4
Pod
undocumented
| |||||||||||
| 32 | 40 | my $self = shift; | |||||||||
| 33 | |||||||||||
| 34 | 40 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | # user's passing their own args - save them | ||||||||||
| 37 | 0 | ▶ | if ( @_ == 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 53 | 6 | return $self->$method; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 34 | return; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 53 | ▶ | sub clone { | ||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 60 | 53 | my ($self) = @_; | |||||||||
| 61 | |||||||||||
| 62 | 53 | my %new = %$self; | |||||||||
| 63 | |||||||||||
| 64 | 53 | return bless \%new, ref $self; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 452 | 1; | |||||||||
| 68 | |||||||||||
| 69 | __END__ | ||||||||||