The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::vaporcalc::CmdEngine

SYNOPSIS

use App::vaporcalc::CmdEngine;
my $eng = App::vaporcalc::CmdEngine->new;
my $help = $eng->prepare_cmd( subject => 'help' );
# See App::vaporcalc::Role::UI::ParseCmd,
#     App::vaporcalc::Role::UI::PrepareCmd,
#     App::vaporcalc::Role::UI::Cmd,
#     App::vaporcalc::Cmd::Result

DESCRIPTION

A class containing a valid "subject_list" for use with vaporcalc(1) command handler roles; see "CONSUMES".

ATTRIBUTES

subject_list

The list of valid vaporcalc(1) subjects (as an List::Objects::WithUtils::Array).

Built by scanning classes in the App::vaporcalc::Cmd::Subject:: namespace via Module::Pluggable and collecting the results of calling their respective _subject methods, which must return unique strings that can be transformed into the appropriate class name; see App::vaporcalc::Role::UI::Cmd.

Command classes without a subject will produce a warning and be omitted from the subject_list.

METHODS

rebuild_subject_list

Rebuilds the "subject_list" by re-scanning the App::vaporcalc::Cmd::Subject:: namespace.

search_path

# Current command module search path:
$eng->search_path;

# Replace the current search path(s):
$eng->search_path( new => 'My::vaporcalc::Cmds' );

# Add another search path & rebuild our subject_list:
$eng->search_path( add => 'My::vaporcalc::Toys' );
$eng->rebuild_subject_list;

Modify the pluggable command module search path. Imported from Module::Pluggable; see there for details.

After search paths have been modified, "rebuild_subject_list" must be called to load the newly-found modules and regenerate the "subject_list" attribute.

CONSUMES

App::vaporcalc::Role::UI::ParseCmd

App::vaporcalc::Role::UI::PrepareCmd

"search_path" in Module::Pluggable

SEE ALSO

App::vaporcalc::Role::UI::Cmd contains an example command subject in the SYNOPSIS.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>