Why not adopt me?
This distribution is up for adoption!
If you're interested then please contact the PAUSE module admins via
email.
NAME
App::vaporcalc::Role::UI::ParseCmd
SYNOPSIS
package MyCmdParser;
use Moo;
has subject_list => (
is => 'ro',
builder => sub {
[ 'nic base', 'flavor' ]
},
);
with 'App::vaporcalc::Role::UI::ParseCmd';
package main;
my $parser = MyCmdParser->new;
# Same as:
# my $result = $parser->parse_cmd("nic base set 100");
my $result = $parser->parse_cmd("set nic base 100");
my $subj = $result->subject; # 'nic base'
my $verb = $result->verb; # 'set'
my $params = $result->params; # params as a List::Objects::WithUtils::Array
DESCRIPTION
A Moo::Role for parsing command strings based on a list of valid subjects (command targets).
REQUIRES
subject_list
The subject_list
method is expected to return an ARRAY or ARRAY-type object containing a list of valid subjects.
METHODS
parse_cmd
Given a string, returns an inflated List::Objects::WithUtils::Hash with subject
, verb
, and params
accessors (see SYNOPSIS).
Used by App::vaporcalc::CmdEngine to parse vaporcalc commands.
AUTHOR
Jon Portnoy <avenj@cobaltirc.org>