line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Class::Workflow::State::Simple; |
4
|
1
|
|
|
1
|
|
2256
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use overload '""' => "stringify", fallback => 1; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# FIXME with Class::Workflow::State should be implied |
9
|
|
|
|
|
|
|
with qw/ |
10
|
|
|
|
|
|
|
Class::Workflow::State |
11
|
|
|
|
|
|
|
Class::Workflow::State::TransitionHash |
12
|
|
|
|
|
|
|
Class::Workflow::State::AcceptHooks |
13
|
|
|
|
|
|
|
Class::Workflow::State::AutoApply |
14
|
|
|
|
|
|
|
/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has name => ( |
17
|
|
|
|
|
|
|
isa => "Str", |
18
|
|
|
|
|
|
|
is => "rw", |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub stringify { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
if ( defined( my $name = $self->name ) ) { |
24
|
|
|
|
|
|
|
return $name; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
return overload::StrVal($_[0]); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has misc => ( |
30
|
|
|
|
|
|
|
isa => "HashRef", |
31
|
|
|
|
|
|
|
is => "rw", |
32
|
|
|
|
|
|
|
default => sub { {} }, |
33
|
|
|
|
|
|
|
auto_deref => 1, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__PACKAGE__; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Class::Workflow::State::Simple - A useful class (or base class) for writing |
45
|
|
|
|
|
|
|
states. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
use Class::Workflow::State::Simple; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $state = Class::Workflow::State::Simple->new( |
52
|
|
|
|
|
|
|
name => "foo", |
53
|
|
|
|
|
|
|
transitions => [ $tn ], # objects |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 FIELDS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item name |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
A string that can be used to identify the state to a factory object like |
65
|
|
|
|
|
|
|
L<Class::Workflow>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item auto_transition |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
see L<Class::Workflow::State::AutoApply>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 ROLES |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This class consumes the following roles: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over 4 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<Class::Workflow::State::TransitionSet> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<Class::Workflow::State::AcceptHooks> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|