| 1 | # ABSTRACT: Container Class for Validation::Class::Field Objects | ||||||||||
| 2 | |||||||||||
| 3 | package Validation::Class::Fields; | ||||||||||
| 4 | { | ||||||||||
| 5 | 56 | $Validation::Class::Fields::VERSION = '7.10_01'; | |||||||||
| 6 | } | ||||||||||
| 7 | |||||||||||
| 8 | 56 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 56 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 56 | our $VERSION = '7.10_01'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | 56 | ▶ | use Carp 'confess'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 56 | ▶ | use base 'Validation::Class::Collection'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 56 | ▶ | use Validation::Class::Field; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | sub add { | ||||||||||
| 21 | |||||||||||
| 22 | 151 | ▶ | my $self = shift; | ||||||||
|
Subroutine
add: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 23 | |||||||||||
| 24 | 151 | ▶ | my %arguments = @_ % 2 ? %{$_[0]} : @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 151 | ▶ | while (my($key, $object) = each %arguments) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | $object->{name} = $key | ||||||||||
| 29 | 172 | ▶ | unless defined $object->{name}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 172 | ▶ | $object = Validation::Class::Field->new($object) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | unless "Validation::Class::Field" eq ref $object; | ||||||||||
| 33 | |||||||||||
| 34 | 172 | $self->{$key} = $object; | |||||||||
| 35 | |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 151 | return $self; | |||||||||
| 39 | |||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | ▶ | sub clear { | |||||||||
|
Subroutine
clear: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 43 | |||||||||||
| 44 | #noop - fields can't be deleted this way | ||||||||||
| 45 | |||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 56 | 1; | |||||||||
| 49 | __END__ | ||||||||||