Form::Factory::Feature::Role::CustomMessage - features with custom messages


Form-Factory documentation Contained in the Form-Factory distribution.

Index


Code Index:

NAME

Top

Form::Factory::Feature::Role::CustomMessage - features with custom messages

VERSION

Top

version 0.020

DESCRIPTION

Top

A feature may consume this role in order to allow the user to specify a custom message on failure.

ATTRIBUTES

Top

message

This is a custom error message for failures. This message is used instead of the one the feature specifies when feature_info, feature_warning, and feature_error are called.

This is inadequate. It should be fixed in the future.

METHODS

Top

feature_info

  $feature->feature_info($message);

Record an info feature message.

feature_warning

  $feature->feature_warning($message);

Record a warning feature message.

feature_error

  $feature->feature_error($message);

Record an error feature message.

AUTHOR

Top

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Top


Form-Factory documentation Contained in the Form-Factory distribution.
package Form::Factory::Feature::Role::CustomMessage;
BEGIN {
  $Form::Factory::Feature::Role::CustomMessage::VERSION = '0.020';
}
use Moose::Role;

has message => (
    is        => 'ro',
    isa       => 'Str',
    predicate => 'has_message',
);

sub feature_info {
    my $self    = shift;
    my $message = $self->message || shift;
    $self->result->info($message);
}

sub feature_warning {
    my $self    = shift;
    my $message = $self->message || shift;
    $self->result->warning($message);
}

sub feature_error {
    my $self    = shift;
    my $message = $self->message || shift;
    $self->result->error($message);
}


1;