view release on metacpan or search on metacpan
t/lib/CLIDTestClass/Basic/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( sub_new_with_options --path=/tmp/));
ok $ret =~ /override path by a command argument/, $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Basic') }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Basic/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple dispatch test/, $class->message('has description');
ok $ret !~ /simple test/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Basic') }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Check/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( WithOptions --hello --target=world ));
ok $ret =~ /for some reasons/, $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Check') }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Check/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple command/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
local $SIG{__WARN__} = sub {};
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Check') }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/CustomLogger/Basic.pm view on Meta::CPAN
like $ret => qr/\[DEBUG\] debug/, $class->message("debug log");
like $ret => qr/\[INFO\] info/, $class->message("log info");
like $ret => qr/\[WARNING\] warn/, $class->message("log warn");
like $ret => qr/\[ERROR\] error/, $class->message("log error");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $capture = IO::Capture::Stderr->new;
$CLIDTest::CustomLogger::DumpMe::Logger = Log::Handler->new;
$CLIDTest::CustomLogger::DumpMe::Logger->add(
screen => {
log_to => 'STDERR',
maxlevel => 'info',
message_layout => '[%L] %m',
alias => 'stderr',
t/lib/CLIDTestClass/Directly/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( --option=hello ));
ok $ret eq 'hello', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::Directly::DumpMe->run_directly }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
no warnings 'redefine';
t/lib/CLIDTestClass/Directly/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(qw( --help ));
ok $ret =~ /single command test/, $class->message('has description');
ok $ret !~ /help me/, $class->message('name section is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLIDTest::Directly::HelpMe->run_directly }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Error/Basic.pm view on Meta::CPAN
my $ret = $class->dispatch(qw( WithOptions --hello --target=world ));
return $class->abort_this_test('obscure error') if $ret eq 'Obscure error';
ok $ret =~ /Compilation failed/, $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::Error->run }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Error/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple command/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
local $SIG{__WARN__} = sub {};
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLIDTest::Error->run }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Inline/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( WithOptions --hello --target=world ));
ok $ret eq 'hello world', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::Inline->run }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Log/Basic.pm view on Meta::CPAN
unlike $ret => qr/\[debug\] debug/, $class->message("no debug log");
like $ret => qr/\[info\] info/, $class->message("log info");
unlike $ret => qr/\[warn\] warn/, $class->message("no log warn");
like $ret => qr/\[error\] error/, $class->message("log error");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $capture = IO::Capture::Stderr->new;
my $ret;
$capture->start;
try { $ret = CLIDTest::Log::DumpMe->run_directly }
catch { $ret = $_ || 'Obscure error' };
$capture->stop;
my $log = join "\n", $capture->read;
t/lib/CLIDTestClass/More/Alias.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( Options --hello --target=world ));
ok $ret eq 'hello world', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::More->run }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/More/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( WithOptions --hello --target=world ));
ok $ret eq 'hello world', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::More->run }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/More/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple command/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
local $SIG{__WARN__} = sub {};
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLIDTest::More->run }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Multi/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( dump_me --option=hello ));
ok $ret eq 'hello', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLI::Dispatch->run(qw/CLIDTest::More CLIDTest::Single/) }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Multi/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple command/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
local $SIG{__WARN__} = sub {};
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLI::Dispatch->run(qw/CLIDTest::More CLIDTest::Single/) }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Single/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( --option=hello ));
ok $ret eq 'hello', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLIDTest::Single->run }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Single/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(qw( --help ));
ok $ret =~ /single command test/, $class->message('has description');
ok $ret !~ /dump me/, $class->message('name section is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLIDTest::Single->run }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Sub/Basic.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( WithOptions --hello --target=world ));
ok $ret eq 'hello world', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Sub') }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
t/lib/CLIDTestClass/Sub/Help.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple command/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Sub') }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Sub/SubHelp.pm view on Meta::CPAN
my $ret = $class->dispatch(@_);
ok $ret =~ /simple manual/, $class->message('has description');
ok $ret !~ /alternative text for simple subcommand/, $class->message('brief description is removed');
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
open my $null, '>', File::Spec->devnull;
my $stdout = select($null);
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Sub') }
catch { $ret = $_ || 'Obscure error' };
select($stdout);
t/lib/CLIDTestClass/Sub/Subcmd.pm view on Meta::CPAN
my $class = shift;
my $ret = $class->dispatch(qw( cmd WithOptionsSub --subcommand --works=great ));
ok $ret eq 'great subcommand', $class->message("dispatch succeeded: $ret");
}
sub dispatch {
my $class = shift;
local @ARGV = @_;
my $ret;
try { $ret = CLI::Dispatch->run('CLIDTest::Sub') }
catch { $ret = $_ || 'Obscure error' };
return $ret;
}
1;
view all matches for this distributionview release on metacpan - search on metacpan