NAME

Mojo::Stateful - State Keeping Base Class

SYNOPSIS

use base 'Mojo::Stateful';

DESCRIPTION

Mojo::Stateful is a generic 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.

has_error

my $has_error = $stateful->has_error;

is_state

my $is_state = $stateful->is_state('writing');
my $is_state = $stateful->is_state(qw/error reading writing/);