Form::Factory::Result::Single - Form result class representing a single result
version 0.022
my $result = Form::Factory::Result::Single->new; $result->is_valid(1); $result->is_success(1); $result->success('success! Hurray! Yippee! Woohoo!'); $result->failure('failure! Shucks! Bummer! Glurgh!'); $result->info('something happened'); $result->warning('something happened, beware!'); $result->error('nothing happened. Ohnoes!'); $result->field_info(foo => 'consider this info about foo'); $result->field_warning(bar => 'bar worked, but you should check it again'); $result->field_error(baz => 'baz is wrong'); $result->clear_messages_for_field('foo'); $result->clear_messages;
This class provides an individual Form::Factory::Result.
A boolean value indicating whether the action checked out okay. When set, the is_validated predicate is set to true.
is_validated
A boolean value indicating whether the action ran okay. When set, the is_outcome_known predicate is set to true.
is_outcome_known
This is the array of Form::Factory::Message objects attached to this result.
This is a hash of other information to attach to the result. This can be anything the action needs to output to the caller. This can be useful for returning references to newly created objects, automatically assigned IDs, etc.
$result->add_message(%options);
The %options are passed to the constructor of Form::Factory::Message. The new message object is added to the end of "messages".
%options
Clears the is_valid and is_success flags (which also clears is_failure, is_validated, and is_outcome_known). This also resets content to an empty hash.
is_valid
is_success
is_failure
content
Empties the list of messages in "messages".
$result->clear_messages_for_field($field);
Clears all messages that are tied to the named field.
$result->info($message);
Adds a new regular info message.
$result->field_info($field, $message);
Adds a new info message tied to the named field.
$result->warning($message);
Adds a new regular warning messages.
$result->field_warning($field, $message);
Adds a new warning message tied to the named field.
$result->error($message);
Adds a new regular error message.
$result->field_error($field, $message);
Adds a new error message tied to the named field.
$result->success($message);
This is shorthand for:
$result->is_success(1); $result->info($message);
$result->failure($message);
$result->is_success(0); $result->error($message);
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.