Andrew Sterling Hanenkamp > Form-Factory > Form::Factory::Feature::Role::CustomControlMessage

Download:
Form-Factory-0.020.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.020   Source  

NAME ^

Form::Factory::Feature::Role::CustomControlMessage - control features with custom messages

VERSION ^

version 0.020

SYNOPSIS ^

  has_control foo => (
      control   => 'text',
      features  => {
          match_code => {
              message => 'Foo values must be even',
              code    => sub { $_[0] % 2 == 0 },
          },
      },
  );

DESCRIPTION ^

A control feature may consume this role in order to allow the user to specify a custom message on failure. This message may include a single "%s" placeholder, which will be filled in with the label or name of the control.

METHODS ^

format_message

  my $formatted_message = $feature->format_message($unformatted_message);

Given a message containing a single %s placeholder, it fills that placeholder with the control's label. If the control does not implement Form::Factory::Control::Role::Labeled, the control's name is used instead.

control_info

Reports an informational message automatically filtered through "format_message".

control_warning

Reports a warning automatically filtered through "format_message".

control_error

Reports an error automatically filtered through "format_error".

AUTHOR ^

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright 2009 Qubling Software LLC.

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: