App::vaporcalc::Role::UI::ParseCmd
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
A Moo::Role for parsing command strings based on a list of valid subjects (command targets).
The subject_list method is expected to return an ARRAY or ARRAY-type object containing a list of valid subjects.
subject_list
Given a string, returns an inflated List::Objects::WithUtils::Hash with subject, verb, and params accessors (see SYNOPSIS).
subject
verb
params
Used by App::vaporcalc::CmdEngine to parse vaporcalc commands.
Jon Portnoy <avenj@cobaltirc.org>
To install App::vaporcalc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::vaporcalc
CPAN shell
perl -MCPAN -e shell install App::vaporcalc
For more information on module installation, please visit the detailed CPAN module installation guide.