« blib/lib/Rose/HTML/Form/Field/DateTime/Range.pm
↑ Summary
blib/lib/Rose/HTML/Form/Field/Option/Container.pm »
| 1 | package Rose::HTML::Object::Repeatable; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 2 | ▶ | use Clone::PP(); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 2 | ▶ | use base 'Rose::HTML::Form'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 2 | our $VERSION = '0.613'; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | # | ||||||||||||||||||||
| 13 | # Class data | ||||||||||||||||||||
| 14 | # | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | use Rose::Class::MakeMethods::Generic | ||||||||||||||||||||
| 17 | 2 | ▶ | ( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 2 | inheritable_scalar => | |||||||||||||||||||
| 19 | [ | ||||||||||||||||||||
| 20 | 'default_prototype_class', | ||||||||||||||||||||
| 21 | ], | ||||||||||||||||||||
| 22 | 2 | ); | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | # | ||||||||||||||||||||
| 25 | # Object data | ||||||||||||||||||||
| 26 | # | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | use Rose::Object::MakeMethods::Generic | ||||||||||||||||||||
| 29 | 2 | ▶ | ( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 30 | 2 | scalar => | |||||||||||||||||||
| 31 | [ | ||||||||||||||||||||
| 32 | 'default_count' => { interface => 'get_set_init' }, | ||||||||||||||||||||
| 33 | 'prototype', | ||||||||||||||||||||
| 34 | ], | ||||||||||||||||||||
| 35 | 2 | ); | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | ▶ | sub init_default_count { 0 } | ||||||||||||||||||
|
Subroutine
init_default_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 7 | ▶ | sub is_repeatable { 1 } | ||||||||||||||||||
|
Subroutine
is_repeatable: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | sub prototype_class | ||||||||||||||||||||
| 42 | 10 | ▶ | { | ||||||||||||||||||
|
Subroutine
prototype_class: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 43 | 10 | my($self) = shift; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 10 | ▶ | if(@_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | { | ||||||||||||||||||||
| 47 | 4 | return $self->{'prototype_class'} = shift; | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 6 | ▶ | return $self->{'prototype_class'} || ref($self)->default_prototype_class; | ||||||||||||||||||
|
Condition66%2/3
$self->{'prototype_class'} || ref($self)->default_prototype_class
MC/DC0%0/2
$self->{'prototype_class'} || ref($self)->default_prototype_class
$self->{'prototype_class'}
ref($self)->default_prototype_class
Truth table66%2/3
A || B
A= $self->{'prototype_class'}B= ref($self)->default_prototype_class
| |||||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | sub prototype_spec | ||||||||||||||||||||
| 54 | 9 | ▶ | { | ||||||||||||||||||
|
Subroutine
prototype_spec: called CC=5 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||
| 55 | 9 | my($self) = shift; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 9 | ▶ | if(@_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 58 | { | ||||||||||||||||||||
| 59 | 3 | ▶ | if(@_ == 1) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 60 | { | ||||||||||||||||||||
| 61 | 3 | ▶ | if(ref($_[0]) eq 'ARRAY') | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 62 | { | ||||||||||||||||||||
| 63 | 0 | $self->{'prototype_spec'} = shift; | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | elsif(ref($_[0]) eq 'HASH') | ||||||||||||||||||||
| 66 | { | ||||||||||||||||||||
| 67 | 3 | $self->{'prototype_spec'} = shift; | |||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | else | ||||||||||||||||||||
| 70 | { | ||||||||||||||||||||
| 71 | 0 | croak "Invalid prototype spec: @_"; | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | else | ||||||||||||||||||||
| 75 | { | ||||||||||||||||||||
| 76 | 0 | $self->{'prototype_spec'} = [ @_ ]; | |||||||||||||||||||
| 77 | } | ||||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 9 | return $self->{'prototype_spec'}; | |||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | sub prototype_clone | ||||||||||||||||||||
| 84 | 34 | ▶ | { | ||||||||||||||||||
|
Subroutine
prototype_clone: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||
| 85 | 34 | my($self) = shift; | |||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | 34 | ▶ | if(my $obj = $self->prototype) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 88 | { | ||||||||||||||||||||
| 89 | 28 | return Clone::PP::clone($obj); | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | else | ||||||||||||||||||||
| 92 | { | ||||||||||||||||||||
| 93 | 6 | ▶ | my $args = $self->prototype_spec || []; | ||||||||||||||||||
|
Condition100%2/2
$self->prototype_spec || []
MC/DC100%1/1
$self->prototype_spec || []
$self->prototype_spec
Truth table100%2/2
A
A= $self->prototype_spec
| |||||||||||||||||||||
| 94 | 6 | ▶ | $args = [ %$args ] if(ref $args eq 'HASH'); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 95 | 6 | return $self->prototype_class->new(@$args); | |||||||||||||||||||
| 96 | } | ||||||||||||||||||||
| 97 | } | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | sub empty_is_ok | ||||||||||||||||||||
| 100 | 41 | ▶ | { | ||||||||||||||||||
|
Subroutine
empty_is_ok: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||
| 101 | 41 | my($self) = shift; | |||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 41 | ▶ | if(@_) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 104 | { | ||||||||||||||||||||
| 105 | 4 | foreach my $form ($self->forms) | |||||||||||||||||||
| 106 | { | ||||||||||||||||||||
| 107 | 2 | $form->empty_is_ok(@_); | |||||||||||||||||||
| 108 | } | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | 4 | ▶ | return $self->{'empty_is_ok'} = $_[0] ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 111 | } | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 37 | my $forms = $self->forms; | |||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 37 | ▶ | return $self->{'empty_is_ok'} unless(@$forms); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 27 | foreach my $form (@$forms) | |||||||||||||||||||
| 118 | { | ||||||||||||||||||||
| 119 | 28 | ▶ | return 0 unless($form->empty_is_ok); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | 6 | return 1; | |||||||||||||||||||
| 123 | } | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | 2 | 1; | |||||||||||||||||||