| 1 | package Form::Factory::Interface; | ||||||||||
| 2 | 1 | $Form::Factory::Interface::VERSION = '0.022'; | |||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Class::Load; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Form::Factory::Stasher::Memory; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | requires qw( render_control consume_control ); | |||||||||
| 10 | |||||||||||
| 11 | # ABSTRACT: Role for form interface implementations | ||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | has stasher => ( | ||||||||||
| 15 | is => 'ro', | ||||||||||
| 16 | does => 'Form::Factory::Stasher', | ||||||||||
| 17 | required => 1, | ||||||||||
| 18 | 14 | ▶ | default => sub { Form::Factory::Stasher::Memory->new }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 1 | handles => [ qw( stash unstash ) ], | |||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | 14 | ▶ | sub new_action { | ||||||||
|
Subroutine
new_action: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||
| 24 | 14 | my ($self, $class_name, $args) = @_; | |||||||||
| 25 | |||||||||||
| 26 | 14 | ▶ | Class::Load::load_class($class_name) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | or Carp::croak("cannot load $class_name: $@"); | ||||||||||
| 28 | |||||||||||
| 29 | 14 | return $class_name->new( %$args, form_interface => $self ); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | |||||||||||
| 33 | 78 | ▶ | sub new_control { | ||||||||
|
Subroutine
new_control: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 34 | 78 | my ($self, $name, $args) = @_; | |||||||||
| 35 | |||||||||||
| 36 | 78 | my $class_name = Form::Factory->control_class($name); | |||||||||
| 37 | 78 | ▶ | return unless $class_name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 78 | return $class_name->new($args); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 1 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||