Form::Factory::Result - Interface for the result classes
version 0.022
my $result = $action->results; if ($result->is_validated and $result->is_valid) { print "Action passed validation.\n"; } if ($result->is_outcome_known and $result->is_success) { print "Action successfully processed.\n"; } print "EXTRA INFO: ", $result->content->{extra_info}, "\n"; print "Messages: ", $result->all_messages, "\n";
After an action has run in part or in whole, a result class will contain the current state of that sucess or failure.
The opposite of "is_success".
my $messages = $result->all_messages; my @messages = $result->all_messages;
Returns all messages. When a scalar is expected, it returns all messages concatenated with a newline between each. When a list is expected, it returns a list of Form::Factory::Message objects.
my $messages = $result->info_messages; my @messages = $result->info_messages;
Returns all mesages with type info. Handles context the same as "all_messages".
my $messages = $result->warning_messages; my @messages = $result->warning_messages;
Returns all messages with type warning. Handles context the same as "all_messages".
my $messages = $result->error_messages; my @messages = $result->error_messages;
Returns all messages with type error. Handles context the same as "all_messages".
my $messages = $result->regular_messages; my @messages = $result->regular_messages;
Returns all messages that are not tied to a field. Handles context the same as "all_messages".
my $messages = $result->regular_info_messages; my @messages = $result->regular_info_messages;
Returns all messages with type info that are not tied to a field. Handles context the same as "all_messages".
my $messages = $result->regular_warning_messages; my @messages = $result->regular_warning_messages;
Returns all messages with type warning that are not tied to a feild. Handles context the same as "all_messages".
my $messages = $result->regular_error_messages; my @messages = $result->regular_error_messages;
Returns all messages with type error that are not tied to a field. Handles context the same as "all_messages".
my $messages = $result->field_messages($field); my @messages = $result->field_messages($field);
Returns all messages that are tied to a particular field. Handles context the same as "all_messages".
my $messages = $result->field_info_messages($field); my @messages = $result->field_info_messages($field);
Returns all messages with type info that are tied to a particular field. Handles context the same as "all_messages".
my $messages = $result->field_warning_messages($field); my @messages = $result->field_warning_messages($field);
Returns all messages with type warning tied to a particular field. Handles context the same as "all_messages".
my $messages = $result->field_error_messages($field); my @messages = $result->field_error_messages($field);
Returns all messages with type error tied to a particular field. Handles context the same as "all_messages".
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
This software is copyright (c) 2015 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Form::Factory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Form::Factory
CPAN shell
perl -MCPAN -e shell install Form::Factory
For more information on module installation, please visit the detailed CPAN module installation guide.