| 1 | package HTML::FormFu::Library; | ||||||||||
| 2 | 3 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | $HTML::FormFu::Library::VERSION = '0.004'; | |||||||||
| 4 | } | ||||||||||
| 5 | |||||||||||
| 6 | # ABSTRACT: Library of precompiled HTML::FormFu forms | ||||||||||
| 7 | |||||||||||
| 8 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 3 | ▶ | use namespace::clean -except => 'meta'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 3 | has model => ( is => 'ro' ); | |||||||||
| 15 | 3 | has query => ( is => 'ro' ); | |||||||||
| 16 | 3 | has stash => ( is => 'ro' ); | |||||||||
| 17 | 3 | has action => ( is => 'ro' ); | |||||||||
| 18 | 3 | has languages => ( is => 'ro' ); | |||||||||
| 19 | 3 | has config_callback => ( is => 'ro' ); | |||||||||
| 20 | 3 | has add_localize_object => ( is => 'ro' ); | |||||||||
| 21 | |||||||||||
| 22 | 3 | has cache => | |||||||||
| 23 | ( | ||||||||||
| 24 | is => 'ro', | ||||||||||
| 25 | required => 1, | ||||||||||
| 26 | isa => 'HashRef', | ||||||||||
| 27 | traits => ['Hash'], | ||||||||||
| 28 | handles => { cached_form => 'get' } | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | sub form | ||||||||||
| 32 | 0 | ▶ | { | ||||||||
|
Subroutine
form: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 33 | 0 | my ($self, @names) = @_; | |||||||||
| 34 | |||||||||||
| 35 | 0 | my @forms = $self->raw_form(@names); | |||||||||
| 36 | |||||||||||
| 37 | 0 | $_->process for @forms; | |||||||||
| 38 | |||||||||||
| 39 | return wantarray | ||||||||||
| 40 | ? @forms | ||||||||||
| 41 | 0 | ▶ | : $forms[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | sub raw_form | ||||||||||
| 45 | 0 | ▶ | { | ||||||||
|
Subroutine
raw_form: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 46 | 0 | my ($self, @names) = @_; | |||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | Carp::croak("Please specify which forms you want to access") unless @names; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 0 | my @forms = map { $_->clone } $self->cached_form(@names); | |||||||||
| 51 | |||||||||||
| 52 | 0 | my @methods = qw(stash query action languages config_callback add_localize_object); | |||||||||
| 53 | |||||||||||
| 54 | 0 | foreach my $form (@forms) | |||||||||
| 55 | { | ||||||||||
| 56 | 0 | foreach my $method (@methods) | |||||||||
| 57 | { | ||||||||||
| 58 | 0 | ▶ | $form->$method( $self->$method ) if $self->$method; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | } | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | return wantarray | ||||||||||
| 63 | ? @forms | ||||||||||
| 64 | 0 | ▶ | : $forms[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | __END__ | ||||||||||