logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

"Commandable::Finder::MethodAttributes" - find commands stored as methods with attributes

Author

       Paul Evans <leonerd@leonerd.org.uk>

perl v5.40.0                                       2024-09-08              Commandable::F...ethodAttributes(3pm)

Constructor

new
          $finder = Commandable::Finder::MethodAttributes->new( %args )

       Constructs a new instance of "Commandable::Finder::MethodAttributes".

       Takes the following named arguments:

       object => OBJ
           An  object  reference. Its class will be used for searching for command methods.  The instance itself
           is stored by the finder object and used to wrap each command method.

       Any additional arguments are passed to the superclass constructor.

Description

       This subclass of Commandable::Finder::SubAttributes looks for methods that define commands, where each
       command is provided by an individual method in a given class. It stores the object instance and arranges
       that each discovered command method will capture it, passing it as the first argument when invoked.

       The attributes on each method are those given by "Commandable::Finder::SubAttributes" and are used in the
       same way here.

Name

       "Commandable::Finder::MethodAttributes" - find commands stored as methods with attributes

Synopsis

          use Commandable::Finder::MethodAttributes;

          my $object = SomeClass->new( ... );

          my $finder = Commandable::Finder::MethodAttributes->new(
             object => $object,
          );

          my $help_command = $finder->find_command( "help" );

          foreach my $command ( $finder->find_commands ) {
             ...
          }

See Also