App::Easer - auto-commands reflection


I added some reflection to get hold of instances for handling auto-commands help, commands, and tree.

While porting a test for App::Easer V2, I found out that there was an undocumented feature in V1 that allowed to get hold of the help and commands sub-commands, e.g. to support command-line options like --help and --commands (e.g. --help might be useful for leaf commands).

So it was natural to extend the interface to add methods that return the related instances:

sub auto_child ($self, $name, $inflate = 0) {
   my $child = __PACKAGE__ . '::' . ucfirst(lc($name));
   ($child) = $self->inflate_children($child) if $inflate;
   return $child;

# ...

sub auto_commands ($self) { return $self->auto_child('commands', 1) }

sub auto_help ($self) { return $self->auto_child('help', 1) }

sub auto_tree ($self) { return $self->auto_child('tree', 1) }

New test onboard!

Comments? Octodon, Twitter, GitHub, Reddit, or drop me a line!