| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::FSM::Utils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
162481
|
use base qw(Exporter); |
|
|
9
|
|
|
|
|
16
|
|
|
|
9
|
|
|
|
|
1528
|
|
|
4
|
9
|
|
|
9
|
|
94
|
use strict; |
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
336
|
|
|
5
|
9
|
|
|
9
|
|
59
|
use warnings; |
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
521
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
4442
|
use Error::Pure qw(err); |
|
|
9
|
|
|
|
|
133730
|
|
|
|
9
|
|
|
|
|
324
|
|
|
8
|
9
|
|
|
9
|
|
990
|
use List::Util 1.33 qw(none); |
|
|
9
|
|
|
|
|
234
|
|
|
|
9
|
|
|
|
|
5031
|
|
|
9
|
9
|
|
|
9
|
|
5458
|
use Mo::utils::Array qw(check_array); |
|
|
9
|
|
|
|
|
27679
|
|
|
|
9
|
|
|
|
|
297
|
|
|
10
|
9
|
|
|
9
|
|
822
|
use Readonly; |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
3651
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(check_transition_objects); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 0.01; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub check_transition_objects { |
|
17
|
17
|
|
|
17
|
1
|
6458
|
my ($self, $key, $objects_ar) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
17
|
100
|
|
|
|
79
|
if (! exists $self->{$key}) { |
|
20
|
7
|
|
|
|
|
20
|
return; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
10
|
|
|
|
|
53
|
check_array($self, $key); |
|
24
|
|
|
|
|
|
|
|
|
25
|
9
|
100
|
100
|
|
|
155
|
if (! defined $objects_ar |
|
26
|
|
|
|
|
|
|
|| ref $objects_ar ne 'ARRAY') { |
|
27
|
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
11
|
err "Parameter '$key' check hasn't defined state objects."; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
7
|
|
|
|
|
18
|
foreach my $obj (@{$self->{$key}}) { |
|
|
7
|
|
|
|
|
24
|
|
|
32
|
7
|
100
|
|
5
|
|
40
|
if (none { $obj->from eq $_ } @{$objects_ar}) { |
|
|
5
|
|
|
|
|
24
|
|
|
|
7
|
|
|
|
|
43
|
|
|
33
|
2
|
|
|
|
|
13
|
err "Parameter '$key' contains object which has 'from' object which isn't in defined objects.", |
|
34
|
|
|
|
|
|
|
'Reference', (ref $obj->from), |
|
35
|
|
|
|
|
|
|
; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
5
|
100
|
|
8
|
|
92
|
if (none { $obj->to eq $_ } @{$objects_ar}) { |
|
|
8
|
|
|
|
|
50
|
|
|
|
5
|
|
|
|
|
22
|
|
|
38
|
2
|
|
|
|
|
23
|
err "Parameter '$key' contains object which has 'to' object which isn't in defined objects.", |
|
39
|
|
|
|
|
|
|
'Reference', (ref $obj->to), |
|
40
|
|
|
|
|
|
|
; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
62
|
return; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding utf8 |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Data::FSM::Utils - Utilities for Data::FSM. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use Data::FSM::Utils qw(check_transition_objects); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
check_transition_objects($key, $objects_ar); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SUBROUTINES |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 C<check_transition_objects> |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
check_transition_objects($key, $objects_ar); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Check parameter defined by C<$key> which is a right object (method from() and |
|
72
|
|
|
|
|
|
|
to() contain instance from C<$objects_ar> list). |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Put error if check isn't ok. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns undef. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 ERRORS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
check_transition_objects(): |
|
81
|
|
|
|
|
|
|
From Mo::utils::Array::check_array(): |
|
82
|
|
|
|
|
|
|
Parameter '%s' must be a array. |
|
83
|
|
|
|
|
|
|
Value: %s |
|
84
|
|
|
|
|
|
|
Reference: %s |
|
85
|
|
|
|
|
|
|
Parameter '%s' check hasn't defined state objects. |
|
86
|
|
|
|
|
|
|
Parameter '%s' contains object which has 'from' object which isn't in defined objects. |
|
87
|
|
|
|
|
|
|
Reference: %s |
|
88
|
|
|
|
|
|
|
Parameter '%s' contains object which has 'to' object which isn't in defined objects. |
|
89
|
|
|
|
|
|
|
Reference: %s |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L<Error::Pure>, |
|
94
|
|
|
|
|
|
|
L<Exporter>, |
|
95
|
|
|
|
|
|
|
L<List::Util>, |
|
96
|
|
|
|
|
|
|
L<Mo::utils::Array>, |
|
97
|
|
|
|
|
|
|
L<Readonly>. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<https://github.com/michal-josef-spacek/Data-FSM> |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Michal Josef Špaček L<mailto:skim@cpan.org> |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<http://skim.cz> |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
© 2025-2026 Michal Josef Špaček |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
BSD 2-Clause License |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 VERSION |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
0.01 |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |