Mason-Tidy
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Mason/Tidy/App.pm view on Meta::CPAN
method run () {
my @argv = @ARGV;
if ( my $envvar = $ENV{MASONTIDY_OPT} ) {
push( @argv, split( /\s+/, $envvar ) );
}
my $source = $_[0];
usage() if !@argv && !$source;
my ( %params, $help, $pipe, $replace, $version );
{
local @ARGV = @argv;
GetOptions(
'h|help' => \$help,
'm|mason-version=i' => \$params{mason_version},
'p|pipe' => \$pipe,
'r|replace' => \$replace,
'indent-block=i' => \$params{indent_block},
'indent-perl-block=i' => \$params{indent_perl_block},
'perltidy-argv=s' => \$params{perltidy_argv},
'perltidy-block-argv=s' => \$params{perltidy_block_argv},
'perltidy-line-argv=s' => \$params{perltidy_line_argv},
lib/Mason/Tidy/t/CLI.pm view on Meta::CPAN
sub test_cli : Tests {
my ( $out, $err );
my $tempdir = tempdir( 'name-XXXX', TMPDIR => 1, CLEANUP => 1 );
write_file( "$tempdir/comp1.mc", "<%2+2%>" );
write_file( "$tempdir/comp2.mc", "<%4+4%>" );
write_file( "$tempdir/comp3.mc", "%if (foo){\n%bar\n%}\n" );
my $cli = sub {
local @ARGV = @_;
( $out, $err ) = capture {
Mason::Tidy::App->run();
};
is( $err, "", "err empty" );
};
$cli->( "-r", "$tempdir/comp1.mc", "$tempdir/comp2.mc", @std_argv );
is( $out, "$tempdir/comp1.mc\n$tempdir/comp2.mc\n", "out empty" );
is( read_file("$tempdir/comp1.mc"), "<% 2 + 2 %>", "comp1" );
is( read_file("$tempdir/comp2.mc"), "<% 4 + 4 %>", "comp2" );
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.010 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )