Perl-Tidy
view release on metacpan or search on metacpan
lib/Perl/Tidy.pm view on Meta::CPAN
blinking => 0,
};
# Fix for issue git #57
$Warn_count = 0;
$nag_message = EMPTY_STRING;
# don't overwrite callers ARGV
# Localization of @ARGV could be avoided by calling GetOptionsFromArray
# instead of GetOptions, but that is not available before perl 5.10
local @ARGV = @ARGV;
local *STDERR = *STDERR;
if ( my @bad_keys = grep { !exists $defaults{$_} } keys %input_hash ) {
local $LIST_SEPARATOR = ')(';
my @good_keys = sort keys %defaults;
@bad_keys = sort @bad_keys;
confess <<EOM;
------------------------------------------------------------------------
Unknown perltidy parameter : (@bad_keys)
perltidy only understands : (@good_keys)
lib/Perl/Tidy.pm view on Meta::CPAN
my ( $roption_string, $rdefaults, $rexpansion,
$roption_category, $rinteger_option_range, $ris_string_option )
= generate_options();
#--------------------------------------------------------------
# set the defaults by passing the above list through GetOptions
#--------------------------------------------------------------
my %Opts = ();
{
local @ARGV = ();
# do not load the defaults if we are just dumping perltidyrc
if ( $dump_options_type ne 'perltidyrc' ) {
for my $i ( @{$rdefaults} ) { push @ARGV, "--" . $i }
}
if ( !GetOptions( \%Opts, @{$roption_string} ) ) {
Die(
"Programming Bug reported by 'GetOptions': error in setting default options"
);
}
lib/Perl/Tidy.pm view on Meta::CPAN
if ( defined($rconfig_string) ) {
my ( $rconfig_list, $death_message ) =
read_config_file( $rconfig_string, $config_file, $rexpansion );
Die($death_message) if ($death_message);
# process any .perltidyrc parameters right now so we can
# localize errors
if ( @{$rconfig_list} ) {
local @ARGV = @{$rconfig_list};
expand_command_abbreviations( $rexpansion, \@raw_options,
$config_file );
check_for_missing_string_options( $ris_string_option,
$config_file );
if ( !GetOptions( \%Opts, @{$roption_string} ) ) {
Die(
"Error in this config file: $config_file \nUse -npro to ignore this file, -dpro to dump it, -h for help'\n"
);
}
# Anything left in this local @ARGV is an error and must be
# invalid bare words from the configuration file. We cannot
# check this earlier because bare words may have been valid
# values for parameters. We had to wait for GetOptions to have
# a look at @ARGV.
if (@ARGV) {
my $count = @ARGV;
my $str = EMPTY_STRING;
foreach my $param (@ARGV) {
if ( length($str) < 70 ) {
if ($str) { $str .= ', ' }
lib/Perl/Tidy.pm view on Meta::CPAN
# by '=string'. If the next word looks like another --option, then it may
# get gobbled up as the string arg. In that case, exit with an error
# message. The user can always force a string arg which looks like an
# option by using the '=string' input form.
# Example of the type of error this sub checks for:
# perltidy -lpil -l=9 filename
# In this sub, any short option forms have already been expanded into their
# long forms, so this will appear here in the local copy of @ARGV as three
# list items:
# @ARGV = qw(
# --line-up-parentheses-inclusion-list
# --maximum-line-length=9
# filename
# );
# Then, since -lpil wants a string value, it will be set equal to
# '--line-up-parentheses=9' by sub GetOptions, which is probably not the
( run in 0.807 second using v1.01-cache-2.11-cpan-70b642e62ca )