| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Catalyst::Controller::HTML::FormFu::Action::FormMethod; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 9 |  |  | 9 |  | 5613 | use strict; | 
|  | 9 |  |  |  |  | 21 |  | 
|  | 9 |  |  |  |  | 403 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | our $VERSION = '2.02'; # VERSION | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 9 |  |  | 9 |  | 49 | use Moose; | 
|  | 9 |  |  |  |  | 23 |  | 
|  | 9 |  |  |  |  | 57 |  | 
| 8 | 9 |  |  | 9 |  | 53608 | use Carp qw( croak ); | 
|  | 9 |  |  |  |  | 21 |  | 
|  | 9 |  |  |  |  | 517 |  | 
| 9 | 9 |  |  | 9 |  | 51 | use namespace::autoclean; | 
|  | 9 |  |  |  |  | 23 |  | 
|  | 9 |  |  |  |  | 69 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | extends 'Catalyst::Controller::HTML::FormFu::ActionBase::Form'; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub execute { | 
| 14 | 1 |  |  | 1 | 1 | 257 | my $self = shift; | 
| 15 | 1 |  |  |  |  | 4 | my ( $controller, $c ) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 | 50 |  |  |  | 24 | if ( $self->reverse =~ $self->_form_action_regex ) { | 
| 18 |  |  |  |  |  |  | # don't load form again | 
| 19 | 0 |  |  |  |  | 0 | return $self->next::method(@_); | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 1 |  |  |  |  | 39 | my $config = $controller->_html_formfu_config; | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | return $self->next::method(@_) | 
| 25 |  |  |  |  |  |  | unless exists $self->attributes->{ActionClass} | 
| 26 | 1 | 50 | 33 |  |  | 23 | && $self->attributes->{ActionClass}[0] eq $config->{method_action}; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 1 |  |  |  |  | 74 | my $form = $controller->_form; | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 1 |  |  |  |  | 3 | for ( @{ $self->{_attr_params} } ) { | 
|  | 1 |  |  |  |  | 4 |  | 
| 31 | 1 |  |  |  |  | 5 | for my $method (split) { | 
| 32 | 1 | 50 |  |  |  | 3 | $c->log->debug($method) if $c->debug; | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 1 |  | 50 |  |  | 9 | my $args = $controller->$method($c) || {}; | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 1 |  |  |  |  | 11 | $form->populate($args); | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 1 |  |  |  |  | 640909 | $form->process; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 1 |  |  |  |  | 1157 | $c->stash->{ $config->{form_stash} } = $form; | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 1 |  |  |  |  | 86 | $self->next::method(@_); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; |