| 1 | package HTML::FormHandler::Field::PrimaryKey; | ||||||||||
| 2 | # ABSTRACT: primary key field | ||||||||||
| 3 | 29 | $HTML::FormHandler::Field::PrimaryKey::VERSION = '0.410002'; | |||||||||
| 4 | 29 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 29 | extends 'HTML::FormHandler::Field'; | |||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 29 | has 'is_primary_key' => ( isa => 'Bool', is => 'ro', default => '1' ); | |||||||||
| 9 | 29 | has '+widget' => ( default => 'Hidden' ); | |||||||||
| 10 | 29 | has '+do_label' => ( default => 0 ); | |||||||||
| 11 | 29 | has '+no_value_if_empty' => ( default => 1 ); | |||||||||
| 12 | |||||||||||
| 13 | 16 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||
| 14 | 16 | my $self = shift; | |||||||||
| 15 | 16 | ▶ | if ( $self->has_parent ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 16 | ▶ | if ( $self->parent->has_primary_key ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | push @{ $self->parent->primary_key }, $self; | |||||||||
| 18 | } | ||||||||||
| 19 | else { | ||||||||||
| 20 | 16 | $self->parent->primary_key( [ $self ] ); | |||||||||
| 21 | } | ||||||||||
| 22 | } | ||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 29 | __PACKAGE__->meta->make_immutable; | |||||||||
| 26 | 29 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 29 | 1; | |||||||||
| 28 | |||||||||||
| 29 | __END__ | ||||||||||