Dist-Zilla-Plugin-PerlTidy

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/App/Command/perltidy.pm  view on Meta::CPAN


# ABSTRACT: perltidy your dist
use Dist::Zilla::App -command;
use Path::Iterator::Rule;
use File::Copy;

sub abstract {'perltidy your dist'}

my $backends = {
    vanilla => sub {
        local @ARGV = ();
        require Perl::Tidy;
        return sub {
            local @ARGV = ();
            Perl::Tidy::perltidy(@_);
        };
    },
    sweet => sub {
        local @ARGV = ();
        require Perl::Tidy::Sweetened;
        return sub {
            local @ARGV = ();
            Perl::Tidy::Sweetened::perltidy(@_);
        };
    },
};

sub opt_spec {
    [ 'backend|b=s', 'tidy backend to use', { default => 'vanilla' } ];
}

sub execute {

lib/Dist/Zilla/Plugin/PerlTidy.pm  view on Meta::CPAN

    if ( defined $self->perltidyrc ) {
        if ( -r $self->perltidyrc ) {
            $perltidyrc = $self->perltidyrc;
        } else {
            $self->log_fatal(
                [ "specified perltidyrc is not readable: %s", $perltidyrc ] );
        }
    }

    # make Perl::Tidy happy
    local @ARGV = ();

    my $destination;
    require Perl::Tidy;
    Perl::Tidy::perltidy(
        source      => \$source,
        destination => \$destination,
        ( $perltidyrc ? ( perltidyrc => $perltidyrc ) : () ),
    );

    $file->content($destination);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.458 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )