File Coverage

blib/lib/Class/Workflow/State.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package Class::Workflow::State;
4 1     1   1284 use Moose::Role;
  0            
  0            
5              
6             requires "transitions"; # enumerate the transitions
7              
8             requires "has_transition";
9             requires "has_transitions";
10              
11             sub accept_instance {
12             my ( $self, $instance, @args ) = @_;
13             return $instance;
14             }
15              
16             __PACKAGE__;
17              
18             __END__
19              
20             =pod
21              
22             =head1 NAME
23              
24             Class::Workflow::State - An instance's position in the workflow.
25              
26             =head1 SYNOPSIS
27              
28             package MyState;
29             use Moose;
30              
31             with 'Class::Workflow::State';
32              
33             =head1 DESCRIPTION
34              
35             This is an abstract role for state implementations. In order ot work properly all states
36              
37             =head1 METHODS
38              
39             =over 4
40              
41             =item accept_instance
42              
43             Since this method is probably not going to be used an empty version is
44             supplied. You may override it, but be sure to return the instance (either the
45             one you got, or if you applied cascaded transitions, the one that you made).
46              
47             Look in L<Class::Workflow::State::AcceptHooks> for an example of how this can
48             be used.
49              
50             =back
51              
52             =head1 REQUIRED METHODS
53              
54             =over 4
55              
56             =item has_transition
57              
58             =item has_transitions
59              
60             Whether or not the state contains the transition B<object> (or objects). You
61             can add more behaviors but it should B<always> work for transition objects.
62              
63             =item transitions
64              
65             This method should return the list of all transition objects. You may add more
66             methods that return the transitions in another organization, but make sure that
67             this method called with no arguments will always return the transitions. When
68             this method is called with arguments it should set the transition list to the
69             new list, or die if the operation is not supported.
70              
71             =back
72              
73             =cut
74              
75