| 1 | package Chloro::Group; | ||
| 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 Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 11 | ▶ | use MooseX::StrictConstructor; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 11 | ▶ | use Chloro::Types qw( CodeRef HashOfFields NonEmptyStr NonEmptySimpleStr ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 11 | with 'Chloro::Role::FormComponent'; | |
| 15 | |||
| 16 | 11 | has _fields => ( | |
| 17 | traits => ['Hash'], | ||
| 18 | isa => HashOfFields, | ||
| 19 | coerce => 1, | ||
| 20 | init_arg => 'fields', | ||
| 21 | required => 1, | ||
| 22 | handles => { | ||
| 23 | fields => 'values', | ||
| 24 | get_field => 'get', | ||
| 25 | }, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 11 | has repetition_key => ( | |
| 29 | is => 'ro', | ||
| 30 | isa => NonEmptyStr, | ||
| 31 | required => 1, | ||
| 32 | ); | ||
| 33 | |||
| 34 | 11 | has is_empty_checker => ( | |
| 35 | is => 'ro', | ||
| 36 | isa => NonEmptySimpleStr, | ||
| 37 | default => '_group_is_empty', | ||
| 38 | ); | ||
| 39 | |||
| 40 | ## no critic (Subroutines::ProhibitBuiltinHomonyms) | ||
| 41 | 8 | ▶ | sub dump { |
|
Subroutine
dump: called CC=1 SCAR=0.0
Pod
documented
| |||
| 42 | 8 | my $self = shift; | |
| 43 | |||
| 44 | return ( | ||
| 45 | repetition_key => $self->repetition_key(), | ||
| 46 | 8 | fields => { map { $_->name() => { $_->dump() } } $self->fields() }, | |
| 47 | ); | ||
| 48 | } | ||
| 49 | ## use critic | ||
| 50 | |||
| 51 | 11 | __PACKAGE__->meta()->make_immutable(); | |
| 52 | |||
| 53 | 11 | 1; | |
| 54 | |||
| 55 | # ABSTRACT: A field in a form | ||
| 56 | |||
| 57 | __END__ | ||