App-Easer
view release on metacpan or search on metacpan
lib/App/Easer/V1.pod view on Meta::CPAN
providing a mapping from C<+> to C<+>, although this will probably make
loading of the package fail in a later stage).
After this expansion of the prefix, if any, the string in C<$executor> is
split into two parts, based on the character C<#>. What comes before is a
I<package> name, what comes after is a I<subroutine> name (defaulting to
C<$default_subname>).
The I<package> is loaded using C<require>, then a reference to the desired
I<subroutine> is taken and returned. If no subroutine exists, an exception
is thrown (C<no '$subname' in '$package'>);
=head2 fetch_spec_for
my $spec = fetch_spec_for($self, $name);
Encapsulation for accessing the specification of one available commands.
It normally maps onto C<< $self->{application}{commands}{$name} >> but
it can be extended, e.g. with C<specfetch> set to
C<+SpecFromHashOrModule> or a custom resolution method.
lib/App/Easer/V2.pod view on Meta::CPAN
$self->validate;
Performs validation.
When a validation sub is set (either calling with a parameter, or
setting it via C<validate> in L</new>) it will be called, receiving
C<$self> as the only parameter:
$sub->($self);
The validator is supposed to throw an exception upon validation failure.
If no validation sub is set, L</params_validate> is looked for. If
present, validation is applied according to it, using
L<Params::Validate>.
=back
=head1 OPTIONS
The main capability provided by C<App::Easer> is the flexibility to
t/V1/01-single.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, ['commands']) } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, ['inexistent']) } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V1/10-stock_factory.t view on Meta::CPAN
'some inline Perl code';
is $factory->(
{executable => sub { return $_[0]{message} }, message => 'hashref'}, ''
)->(), 'hashref', 'hash reference as executable';
my $sub1 = $factory->('+help', '');
my $sub2 = \&App::Easer::V1::stock_help;
is "$sub1", "$sub2", 'prefix + to get stock functions';
for my $error (['This', 'whatever'], ['Inexistent#function', '']) {
throws_ok { $factory->($error->@*) } qr{locate},
'exception sent as expected';
}
done_testing();
t/V1/12-namenv.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, ['commands']) } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, ['inexistent']) } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V1/16-auto-env.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, ['commands']) } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, ['inexistent']) } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V1/17-auto-env-command.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, ['commands']) } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, ['inexistent']) } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V2/01-single.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, $0 => 'commands') } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, $0 => 'inexistent') } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V2/12.automatic-env-names.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, MAIN => 'commands') } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, MAIN => 'inexistent') } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
t/V2/16-auto-env.t view on Meta::CPAN
GALOOK_BAR .*?
help .*?
commands .*?
)}, 'output of help command';
stdout_like { run($app, $0, 'commands') } qr{(?mxs:
help .*?
commands .*?
)}, 'output of help command';
throws_ok { run($app, $0, 'inexistent') } qr{(?mxs:
cannot .*? inexistent
)}, 'inexistent command generates complaint';
done_testing();
( run in 0.302 second using v1.01-cache-2.11-cpan-496ff517765 )