Commandable::Finder::Packages - find commands stored per package
Commandable::Finder::Packages
use Commandable::Finder::Packages; my $finder = Commandable::Finder::Packages->new( base => "MyApp::Command", ); my $help_command = $finder->find_command( "help" ); foreach my $command ( $finder->find_commands ) { ... }
This implementation of Commandable::Finder looks for implementations of commands, where each command is implemented by a different package somewhere in the symbol table.
This class uses Module::Pluggable to load packages from the filesystem. As commands are located per package (and not per file), the application can provide special-purpose internal commands by implementing more packages in the given namespace, regardless of which files they come from.
$finder = Commandable::Finder::Packages->new( %args )
Constructs a new instance of Commandable::Finder::Packages.
Takes the following named arguments:
The base of the package namespace to look inside for packages that implement commands.
Optional. Gives the name of the method inside each command package to invoke to generate the name of the command. Default COMMAND_NAME.
COMMAND_NAME
Optional. Gives the name of the method inside each command package to invoke to generate the description text of the command. Default COMMAND_DESC.
COMMAND_DESC
Optional. If true, the name of each command will be taken from its package name. with the leading base string removed. If absent or false, the name_method will be used instead.
base
name_method
If either name or description method are missing from a package, that package is silently ignored.
Paul Evans <leonerd@leonerd.org.uk>
To install Commandable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Commandable
CPAN shell
perl -MCPAN -e shell install Commandable
For more information on module installation, please visit the detailed CPAN module installation guide.