GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Class::Workflow::Transition::Validate(3) User Contributed Perl Documentation Class::Workflow::Transition::Validate(3)

Class::Workflow::Transition::Validate - Provide a hook for validating a transition (conditionals, input validators, etc).

        package MyTransition;
        use Moose;

        with qw/
                Class::Workflow::Transition
                Class::Workflow::Transition::Validate
        /;

        sub validate {
                my ( $self, $instance, %args ) = @_;

                die "only the owner can apply this transition"
                        unless $args{user} eq $instance->owner;
        }

This role will call the "validate" method at the appropriate time.

"validate" receives the same arguments as "apply", and is expected to die if any of the parameters for the transition are invalid.

Technically, this role doesn't do much more than adding syntactic sugar for "before 'apply'". However, it's value is in the convention that you can call "validate" without applying the body. This eases writing side effect free introspection of transitions.

2009-01-10 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.