Andrew Sterling Hanenkamp > Form-Factory-0.020 > Form::Factory::Feature::Role::Clean

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::Clean - features that clean up control values

VERSION ^

version 0.020

SYNOPSIS ^

  package MyApp::Feature::Foo;
  use Moose;

  with qw(
      Form::Factory::Feature
      Form::Factory::Feature::Role::Control
      Form::Factory::Feature::Role::Clean
  );

  sub clean {
      my $self = shift;

      # Clean up the value, replace it with Foo
      $self->control->{something}->current_value('Foo');
  }

  package Form::Factory::Feature::Foo;
  sub register_implementation { 'MyApp::Feature::Foo' }

DESCRIPTION ^

This is for features that run during the clean phase. This runs immediately after the input has been consumed and before it is checked. These features should avoid reporting errors. The intention is for these features to clean up the input automatically before it is checked for errors. This should work with the control values rather than the action attributes directly, since those won't be set yet.

It is possible for the clean method to stop processing by marking the result as invalid, but it is better to do that using Form::Factory::Feature::Role::Clean.

ROLE METHODS ^

clean

This is called immediately after input has been consumed and before the input is checked for errors. This method should be used to clean up the input. It should not be used to validate the input since other clean methods may run after this one and the input is not yet in its final state.

The method will receive no arguments except the object it is called upon and the return value is ignored. Any output it needs to send should be placed in the result object.

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: