Guess what this is:
State: installed
{
message => undef,
result => 1
}
State: version
{
message => undef,
result => '1'
}
That's part of a state machine stacktrace. This should be on the CPAN soon. David and I (mostly David) have put together a state machine module that's actually user friendly. Here is the definition of the first two states:
my $fail = sub {! shift->result };
my $succeed = sub { shift->result } ;
my @state_machine = (
installed => {
on_enter => sub {
my $machine = shift;
$machine->set_result($self->_is_installed);
$machine->set_message($self->app_name ." does not appear to be i
unless $machine->result;
},
rules => [
fail => $fail,
version => $succeed,
],
},
version => {
on_enter => sub {
my $machine = shift;
$machine->set_result($self->_is_required_version);
unless ($machine->result) {
my $required = $self->build->_required_version;
my $actual = $self->info->version;
$machine->set_message($self->app_name
. " required version $required but you have $actual");
}
},
rules => [
fail => $fail,
createlang => $succeed,
],
},
David has already released FSA::Rules, , but with the new version that's being created, there will be a lot more power, including the stack traces shown. Frankly, I'm surprised that the machines currently available on the CPAN are not this useful. Now that I see how they work, I can't believe that I've not paid attention to them before. They make (some) complex tasks so much easier. I'll just have to avoid the temptation to reach for them when I don't need them.