Mojo::Stateful - Stateful Base Class
use base 'Mojo::Stateful';
Mojo::Stateful is a base class for state keeping instances.
Mojo::Stateful implements the following attributes.
state_cb
my $cb = $stateful->state_cb; $stateful = $stateful->state_cb(sub {...});
Mojo::Stateful inherits all methods from Mojo::Base and implements the following new ones.
done
$stateful = $stateful->done;
error
my $error = $stateful->error; $stateful = $stateful->error('Parser error: test 123');
has_error
my $has_error = $stateful->has_error;
is_done
my $done = $stateful->is_done;
is_finished
my $finished = $stateful->is_finished;
is_state
my $is_state = $stateful->is_state('writing'); my $is_state = $stateful->is_state(qw/error reading writing/);
state
my $state = $stateful->state; $stateful = $stateful->state('writing');
To install Mojo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo
CPAN shell
perl -MCPAN -e shell install Mojo
For more information on module installation, please visit the detailed CPAN module installation guide.