NAME

App::vaporcalc::Role::UI::Cmd - Helper for vaporcalc command objects

SYNOPSIS

package App::vaporcalc::Cmd::Subject::Foo;
use Moo;
with 'App::vaporcalc::Role::UI::Cmd';

DESCRIPTION

A Moo::Role providing attributes & behavior common to App::vaporcalc command objects.

ATTRIBUTES

verb

The action to perform.

An empty string by default. Consumers may want to override to provide a default action.

params

The parameters for the command, as a "ArrayObj" in List::Objects::Types.

Can be coerced from a plain ARRAY.

recipe

The App::vaporcalc::Recipe object being operated on.

Required by default.

METHODS

execute

A default dispatcher that, when called, converts "verb" to lowercase and attempts to find a method named _action_$verb to call.

throw_exception

$self->throw_exception(
  message => 'failed!'
);

Throw an exception object.

munge_recipe

my $new_recipe = $self->munge_recipe( 
  target_vg => 50, 
  target_pg => 50 
);

Calls TO_JSON on the current "recipe" object, merges in the given key/value pairs, and returns a new App::vaporcalc::Recipe with the appropriate values.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>