Skip to content

Instantly share code, notes, and snippets.

View jonswar's full-sized avatar

Jonathan Swartz jonswar

View GitHub Profile
package JS::Perl::Tidy;
use Perl::Tidy qw();
use strict;
use warnings;
sub perltidy {
return Perl::Tidy::perltidy( prefilter => \&prefilter, postfilter => \&postfilter, @_ );
}
sub prefilter {
# Separate out compiler and request parameters
#
$self->{compiler_params} = {};
my %is_compiler_attribute =
map { ( $_, 1 ) } $self->compiler_class->meta->get_attribute_list();
foreach my $key ( keys(%$params) ) {
if ( $is_compiler_attribute{$key} ) {
$self->{compiler_params}->{$key} = delete( $params->{$key} );
}
}