Acme-FSM

 view release on metacpan or  search on metacpan

lib/FSM.pm  view on Meta::CPAN


B<(warning)>, L<B<fst()> method|/fst()>.
No arguments, it's an error.
However, instead of promptly dieing, C<undef> is returned
in blind hope this will be devastating enough.

=item C<[fst]: (%s): no such {fst} record>

B<(warning)>, L<B<fst()> method|/fst()>.
Requested entry I<%s> is missing.
State record ought to exist beforehand for any usecase except
L<record creation|/set {state} of specific $state>.

=item C<[fst]: too many args (%i)>

B<(warning)>, L<B<fst()> method|/fst()>.
Too many args have been passed in.
And again, instead of prompt dieing C<undef> is returned.

=item C<[fst]: updating {%s} record>

t/base/fst.t  view on Meta::CPAN

AFSMTS_method_wrap $method, $fste;
is_deeply $rc, $elder, qq|$tag other {fst} isn't affected|;

$tag = q|four args,|;
AFSMTS_method_wrap $method, qw| beans billy lazar contango |;
like $stderr, qr<(?m)^\Q[fst]: too many args (4)>, qq|$tag noted|;
is scalar keys %{$bb->{_}{fst}}, 2, qq|$tag {fst} is intact|;
AFSMTS_method_wrap $method, $fste;
is_deeply $rc, $elder, qq|$tag first {fst} isn't affected|;
AFSMTS_method_wrap $method, $fsto;
is_deeply $rc, $youngster, qq|$tag second {fst} isn't affected|;

# vim: set filetype=perl

t/process/filter.t  view on Meta::CPAN

    S1 =>
    { switch =>     \&consume_one,
      eturn  => [qw| STOP DONE |],
      tturn  => [qw|   S1 NEXT |]                     }                 },
[[qw| DONE |], { %plug, queue => [ ], found => [ ]}                     ],
[[qw| DONE |], { %plug, queue => [qw| Vulpix |], found => [ ]}          ],
[[qw| DONE |],
    { %plug, queue => [qw| Vulpix |], found => [qw| Persian |]}         ],
[[qw|                                                           DONE |],
    { %plug, queue => [qw| Vulpix |], found => [qw| Persian Buoysel |]} ] ],
  q|{filter-second-with-states}| =>
 [{                                             %common,
    S0 =>
    { switch =>     \&consume_one,
      eturn  => [qw| STOP DONE |],
      tturn  => [qw|   S1 NEXT |]                     },
    S1 =>
    { switch => sub { push @{$_[0]->{queue}}, $_[1] },
      eturn  => [qw|                     STOP DONE |],
      tturn  => [qw|                       S2 NEXT |] },
    S2 =>

t/process/filter.t  view on Meta::CPAN

      eturn  => [qw| STOP DONE |],
      tturn  => [qw|   S1 NEXT |]                                } },
[[qw| DONE |], { %plug, queue => [ ], found => [ ]}                ],
[[qw| DONE |], { %plug, queue => [qw| Vulpix |], found => [ ]}     ],
[[qw|                                                  DONE |],
    { %plug, queue => [qw| Vulpix |], found => [qw| Persian |]}    ],
[[qw|                            DONE |],
    { %plug,
      queue => [qw|          Vulpix |],
      found => [qw| Persian Buoysel |] }                           ]      ],
  q|{filter-second-with-branches}| =>                              
 [{                                             %common,
    S0 =>
    { switch => sub             {
          push @{$_[0]->{found}}, $_[1];
          @{$_[0]->{found}} <= 0 },
      eturn  => [qw|  STOP DONE |],
      tturn  => [qw|    S0 NEXT |],
      fturn  => [qw|    S1 NEXT |]                    },
    S1 =>
    { switch => sub { push @{$_[0]->{queue}}, $_[1] },



( run in 1.114 second using v1.01-cache-2.11-cpan-39bf76dae61 )