Form::Factory::Feature - Interface for objects that modify how actions work


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

Index


Code Index:

NAME

Top

Form::Factory::Feature - Interface for objects that modify how actions work

VERSION

Top

version 0.020

SYNOPSIS

Top

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

  with qw( Form::Factory::Feature );

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

DESCRIPTION

Top

A feature modifies what the form does during processing.

ATTRIBUTES

Top

name

The short name of the feature. This is automatically built from the feature's class name.

action

The action this feature has been attached to.

result

This is the Form::Factory::Result::Single recording the success or failure of the parts of this feature.

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;
BEGIN {
  $Form::Factory::Feature::VERSION = '0.020';
}
use Moose::Role;

use Scalar::Util qw( blessed );

has name => (
    is        => 'ro',
    isa       => 'Str',
    required  => 1,
    lazy      => 1,
    default   => sub {
        my $self = shift;
        my $class_name = blessed $self;
        unless ($class_name =~ s/^Form::Factory::Feature::Control:://) {
            $class_name =~ s/^Form::Factory::Feature:://;
        }
        $class_name =~ s/(\p{Lu})/_\l$1/g;
        $class_name =~ s/\W+/_/g;
        $class_name =~ s/_+/_/g;
        $class_name =~ s/^_//;
        return lc $class_name;
    },
);

has action => (
    is        => 'ro',
    does      => 'Form::Factory::Action',
    required  => 1,
    weak_ref  => 1,
);

has result => (
    is        => 'ro',
    isa       => 'Form::Factory::Result::Single',
    required  => 1,
    lazy      => 1,
    default   => sub { Form::Factory::Result::Single->new },
);

1;