GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Commandable::Finder::Packages(3) User Contributed Perl Documentation Commandable::Finder::Packages(3)

"Commandable::Finder::Packages" - find commands stored per package

   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:

base => STR
The base of the package namespace to look inside for packages that implement commands.
name_method => STR
Optional. Gives the name of the method inside each command package to invoke to generate the name of the command. Default "COMMAND_NAME".
description_method => STR
Optional. Gives the name of the method inside each command package to invoke to generate the description text of the command. Default "COMMAND_DESC".
arguments_method => STR
Optional. Gives the name of the method inside each command package to invoke to generate a list of argument specifications. Default "COMMAND_ARGS".
options_method => STR
Optional. Gives the name of the method inside each command package to invoke to generate a list of option specifications. Default "COMMAND_OPTS".
named_by_package => BOOL
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.

If either name or description method are missing from a package, that package is silently ignored.

Paul Evans <leonerd@leonerd.org.uk>
2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.