Mojo-PrettyTidy
view release on metacpan or search on metacpan
bin/mojo-prettytidy view on Meta::CPAN
exit 0;
}
my @inputs = @ARGV;
my $cfg = {};
my @files = _collect_input_files( @inputs );
if ( $opt_source{config} eq 'cli' ) {
$cfg = _load_config_file( $opt{config} );
_validate_config( $cfg, $opt{config} );
} else {
my $config_path = _find_default_config_file();
if ( length $config_path ) {
$opt{config} = $config_path;
$opt_source{config} = 'auto';
$cfg = _load_config_file( $config_path );
_validate_config( $cfg, $config_path );
}
}
for my $name (
qw(attributes columns indent_width javascript outdir perl prefix
tab_width) )
{
next unless exists $cfg->{$name};
next unless $opt_source{$name} eq 'default';
bin/mojo-prettytidy view on Meta::CPAN
return $content;
}
sub _spew ( $path, $content ) {
open my $fh, '>', $path or die "Cannot open '$path' for writing: $!";
print {$fh} $content or die "Cannot write '$path': $!";
close $fh or die "Cannot close '$path': $!";
}
sub _validate_config ( $cfg, $path ) {
my %allowed = map { $_ => 1 } qw(
attributes
columns
indent_width
javascript
outdir
prefix
perl
tab_width
);
( run in 0.830 second using v1.01-cache-2.11-cpan-0b5f733616e )