NAME
Mojo::Stateful - Stateful Base Class
SYNOPSIS
use base 'Mojo::Stateful';
DESCRIPTION
Mojo::Stateful is a base class for state keeping instances.
ATTRIBUTES
error
my $error = $stateful->error;
$stateful = $stateful->error('Parser error: test 123');
state
my $state = $stateful->state;
$stateful = $stateful->state('writing');
METHODS
Mojo::Stateful inherits all methods from Mojo::Base and implements the following new ones.
done
$stateful = $stateful->done;
has_error
my $has_error = $stateful->has_error;
is_done
my $done = $stateful->is_done;
is_finished
my $finished = $stateful->is_finished;
Returns true if state
is done
or error
. Returns false otherwise.
is_state
my $is_state = $stateful->is_state('writing');
my $is_state = $stateful->is_state(qw/error reading writing/);