/usr/share/perl5/Catalyst/Controller/HTML/FormFu/ActionBase/Form.pm is in libcatalyst-controller-html-formfu-perl 2.02-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | package Catalyst::Controller::HTML::FormFu::ActionBase::Form;
use strict;
our $VERSION = '2.02'; # VERSION
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Action'; }
sub _form_action_regex {
return qr/_FORM_(RENDER|(NOT_)?(VALID|COMPLETE|SUBMITTED))\z/;
}
sub dispatch {
my $self = shift;
my ($c) = @_;
$self->next::method( @_ );
my $controller = $c->component( $self->class );
my $config = $controller->_html_formfu_config;
my $multi = $c->stash->{ $config->{multiform_stash} };
my $form = $c->stash->{ $config->{form_stash} };
my $run_form_render_action = 1;
# _FORM_COMPLETE
my $complete_method = $self->name . "_FORM_COMPLETE";
if ( defined $multi
&& ( my $code = $controller->can( $complete_method ) )
&& $multi->complete )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $complete_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$run_form_render_action = 0;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _FORM_SUBMITTED
my $submitted_method = $self->name . "_FORM_SUBMITTED";
if ( ( my $code = $controller->can( $submitted_method ) )
&& $form->submitted )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $submitted_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _FORM_VALID
my $valid_method = $self->name . "_FORM_VALID";
if ( ( my $code = $controller->can( $valid_method ) )
&& $form->submitted_and_valid )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $valid_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$run_form_render_action = 0
if !defined $multi;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _FORM_NOT_COMPLETE
my $not_complete_method = $self->name . "_FORM_NOT_COMPLETE";
if ( defined $multi &&
( my $code = $controller->can( $not_complete_method ) )
&& $form->submitted && !$multi->complete )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $not_complete_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _FORM_NOT_VALID
my $not_valid_method = $self->name . "_FORM_NOT_VALID";
if ( ( my $code = $controller->can( $not_valid_method ) )
&& $form->submitted && $form->has_errors )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $not_valid_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _FORM_NOT_SUBMITTED
my $not_submitted_method = $self->name . "_FORM_NOT_SUBMITTED";
if ( ( my $code = $controller->can( $not_submitted_method ) )
&& !$form->submitted )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $not_submitted_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
# _RENDER
my $render_method = $self->name . "_FORM_RENDER";
if ( $run_form_render_action
&& ( my $code = $controller->can( $render_method ) ) )
{
my @reverse = split /\//, $self->reverse;
$reverse[-1] = $render_method;
local $self->{reverse} = join '/', @reverse;
local $self->{code} = $code;
$c->execute( $self->class, $self, @{ $c->req->args } );
}
return;
}
1;
|