From 70f31313f9e17d608246a6c3df1cc2f4cf0c1a0c Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 7 Apr 2014 18:13:59 -0700 Subject: [PATCH] Imported Upstream version 20140328 --- BUGS | 3 + CHANGES | 20 ++++++ MANIFEST | 4 -- META.yml | 4 +- Makefile.PL | 1 + TODO | 8 --- bin/perltidy | 2 +- debian/changelog | 151 ------------------------------------------ debian/control | 20 ------ debian/copyright | 12 ---- debian/rules | 88 ------------------------- docs/perltidy.1 | 4 +- lib/Perl/Tidy.pm | 163 ++++++++++++++++++++++------------------------ lib/Perl/Tidy.pod | 11 ++-- 14 files changed, 111 insertions(+), 380 deletions(-) delete mode 100644 debian/changelog delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100755 debian/rules diff --git a/BUGS b/BUGS index d43b28e..d7cdc37 100644 --- a/BUGS +++ b/BUGS @@ -30,6 +30,9 @@ Perltidy open BUGS and LIMITATIONS correctly. Perltidy does not handle UTF-8 encoded files + This has long been requested but unfortunately I don't have time, so + it won't happen unless someone wants to work on it. + Two iterations are sometimes needed Usually the code produced by perltidy on the first pass does not change if it is run again, but sometimes a second pass will produce some small diff --git a/CHANGES b/CHANGES index 1ce5574..348c11c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,24 @@ Perltidy Change Log + 2014 03 28 + - Fixed RT #94190 and debian Bug #742004: perltidy.LOG file left behind. + Thanks to George Hartzell for debugging this. The problem was + caused by the memoization speedup patch in version 20121207. An + unwanted flag was being set which caused a LOG to be written if + perltidy was called multiple times. + + - New default behavior for LOG files: If the source is from an array or + string (through a call to the perltidy module) then a LOG output is only + possible if a logfile stream is specified. This is to prevent + unexpected perltidy.LOG files. + + - Fixed debian Bug #740670, insecure temporary file usage. File::Temp is now + used to get a temporary file. Thanks to Don Anderson for a patch. + + - Any -b (--backup-and-modify-in-place) flag is silently ignored when a + source stream, destination stream, or standard output is used. + This is because the -b flag may have been in a .perltidyrc file and + warnings break Test::NoWarnings. Thanks to Marijn Brand. + 2013 09 22 - Fixed RT #88020. --converge was not working with wide characters. diff --git a/MANIFEST b/MANIFEST index 6dcbc4c..61cc4fa 100644 --- a/MANIFEST +++ b/MANIFEST @@ -8,10 +8,6 @@ Makefile.npm README TODO bin/perltidy -debian/changelog -debian/control -debian/copyright -debian/rules docs/README docs/perltidy.1 docs/stylekey.pod diff --git a/META.yml b/META.yml index 8db6b79..aa50592 100644 --- a/META.yml +++ b/META.yml @@ -1,10 +1,10 @@ --- #YAML:1.0 name: Perl-Tidy -version: 20130922 +version: 20140328 abstract: indent and reformat perl scripts author: - Steve Hancock -license: unknown +license: GPL-2.0+ distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 diff --git a/Makefile.PL b/Makefile.PL index dc8474f..968a70a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -14,6 +14,7 @@ VERSION_FROM => "lib/Perl/Tidy.pm", $] >= 5.005 ? ( ABSTRACT => 'indent and reformat perl scripts', + LICENSE => 'GPL-2.0+', AUTHOR => 'Steve Hancock ' ) : () diff --git a/TODO b/TODO index 4c33354..6988c5b 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,9 @@ Perltidy TODO List This is a partial "wish-list" of features to add and things to do. - Provide an option to ignore side comments when checking line length. - That is, side comments would be allowed to be arbitrarily long without - influencing line breaks. - Improved Vertical Alignment There are still many opportunities for improving vertical alignment. - Minimize the instances in which formatting changes on a second iteration. - - Add a convergence test when -it=n is used - Documentation A FAQ is needed to explain some of the more subtle formatting issues, and to give examples of different styles. diff --git a/bin/perltidy b/bin/perltidy index 0809763..7800565 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -3093,7 +3093,7 @@ perlstyle(1), Perl::Tidy(3) =head1 VERSION -This man page documents perltidy version 20130922. +This man page documents perltidy version 20140328. =head1 CREDITS diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 01d65c8..0000000 --- a/debian/changelog +++ /dev/null @@ -1,151 +0,0 @@ -perltidy (20130805-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Mon, 05 Aug 2013 06:59:59 -0700 - -perltidy (20121207-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Wed, 17 Jul 2013 06:59:59 -0700 - -perltidy (20121207-1) unstable; urgency=low - - * new upstream release - - -- steve hancock fri, 07 dec 2012 06:59:59 -0700 - -perltidy (20120717-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 17 Jul 2012 06:59:59 -0700 - -perltidy (20120714-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Sat, 14 Jul 2012 06:59:59 -0700 - -perltidy (20120701-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Sun, 01 Jul 2012 06:59:59 -0700 - -perltidy (20120619-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 19 Jun 2012 06:59:59 -0700 - -perltidy (20101217-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Fri, 17 Dec 2010 06:59:59 -0700 - -perltidy (20090616-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 16 Jun 2009 06:59:59 -0700 - -perltidy (20071205-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Wed, 05 Dec 2007 09:54:33 -0800 - -perltidy (20070801-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 31 Jul 2007 19:12:50 -0700 - -perltidy (20070508-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 08 May 2007 13:04:28 -0700 - -perltidy (20070504-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Fri, 04 May 2007 07:03:29 -0700 - -perltidy (20070424-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 24 Apr 2007 16:40:09 -0700 - -perltidy (20060719-1) unstable; urgency=low - - * New upstream release - - - -- Steve Hancock Wed, 19 Jul 2006 16:16:15 -0700 - -perltidy (20060614-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 13 Jun 2006 18:59:02 -0700 - - -perltidy (20031021-1) unstable; urgency=low - - * New upstream release - - -- Steve Hancock Tue, 21 Oct 2003 20:50:49 -0700 - -perltidy (20030726-1) unstable; urgency=low - - * New upstream - * Changed Build-Depends perl (>= 5.8.0-7) to perl (>=5.6.1-7) - - -- Steve Hancock Sat, 26 Jul 2003 07:18:13 -0700 - -perltidy (20021130-1) unstable; urgency=low - - * New upstream - * Redid all debian packaging from scratch - - -- Aubin Paul Sat, 30 Nov 2002 23:34:34 -0500 - -perltidy (20011020-1) unstable; urgency=low - - * New upstream release. - * Don't install perl2web in the man dir, but only in the doc dir - (closes: bug#113911, bug#103443, bug#101100). - - -- Paolo Molaro Sun, 11 Nov 2001 15:38:40 +0100 - -perltidy (20010608-1) unstable; urgency=low - - * New upstream release. - * New maintainer (Closes: bug#100250). - - -- Paolo Molaro Mon, 11 Jun 2001 11:54:54 +0200 - -perltidy (20010328-1) unstable; urgency=low - - * New upstream release. - * Corrected upstream email address in copyright file and manpages. - * Fixed lintian warning because of incorrect upstream changelog name. - - -- Dr. Guenter Bechly Fri, 30 Mar 2001 10:57:12 +0200 - -perltidy (20010323-1) unstable; urgency=low - - * Initial Release; closes: #91927 - * Adjusted paths in Makefile and fixed $DESTDIR problems. - - -- Dr. Guenter Bechly Tue, 27 Mar 2001 19:39:30 +0200 - -Local variables: -mode: debian-changelog -End: diff --git a/debian/control b/debian/control deleted file mode 100644 index 5107fe8..0000000 --- a/debian/control +++ /dev/null @@ -1,20 +0,0 @@ -Source: perltidy -Section: interpreters -Priority: optional -Maintainer: Steve Hancock -Build-Depends: debhelper (>= 3.0.5), perl (>= 5.6.1-7) -Standards-Version: 3.5.1 - -Package: perltidy -Architecture: all -Depends: ${perl:Depends} -Description: A Perl script indenter and reformatter - Perltidy is a Perl script which indents and reformats Perl - scripts to make them easier to read. - . - The formatting can be controlled with command line parameters. - The default parameter settings approximately follow the - suggestions in the Perl Style Guide. - . - If you write Perl scripts, or spend much time reading them, - you will probably find it useful. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 8cc9b9d..0000000 --- a/debian/copyright +++ /dev/null @@ -1,12 +0,0 @@ -This is the debian package for the Perl::Tidy module. -It was created by Aubin Paul using dh-make-perl. - -This copyright info was automatically extracted from the perl module. -It may not be accurate, so you better check the module sources -if don't want to get into legal troubles. - -The upstream author is: Steve Hancock - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License Version 2, found on Debian systems -in the file /usr/share/common-licenses/GPL diff --git a/debian/rules b/debian/rules deleted file mode 100755 index f6289a7..0000000 --- a/debian/rules +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/make -f -#-*- makefile -*- -# Made with the aid of dh_make, by Craig Small -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -# Some lines taken from debmake, by Christoph Lameter. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 -export DH_COMPAT=3 - -PACKAGE=$(shell dh_listpackages) - -ifndef PERL -PERL = /usr/bin/perl -endif - -ifndef DESTDIR -DESTDIR=.. -endif -TMP =`pwd`/debian/$(PACKAGE) - -build: build-stamp -build-stamp: - dh_testdir - - - # Add here commands to compile the package. - $(PERL) Makefile.PL INSTALLDIRS=vendor - $(MAKE) OPTIMIZE="-O2 -g -Wall" - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) realclean - - dh_clean - -install: - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/tmp. - #$(MAKE) install DESTDIR=`pwd`/debian/tmp - $(MAKE) install PREFIX=$(TMP)/usr - - -# Build architecture-dependent files here. -binary-arch: build install -# We have nothing to do by default. - -# Build architecture-independent files here. -binary-indep: build install -# dh_testversion - dh_testdir - dh_testroot - dh_installdocs BUGS TODO README examples/README docs/README - dh_installexamples - dh_installmenu -# dh_installemacsen -# dh_installinit - dh_installcron - dh_installman -# dh_undocumented - dh_installchangelogs CHANGES - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_makeshlibs - dh_installdeb - dh_perl - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb --destdir=$(DESTDIR) - -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary diff --git a/docs/perltidy.1 b/docs/perltidy.1 index feed5e1..4ad6877 100644 --- a/docs/perltidy.1 +++ b/docs/perltidy.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PERLTIDY 1" -.TH PERLTIDY 1 "2013-09-22" "perl v5.14.2" "User Contributed Perl Documentation" +.TH PERLTIDY 1 "2014-03-27" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -3183,7 +3183,7 @@ purpose of this rule is to prevent generating confusing filenames such as \&\fIperlstyle\fR\|(1), \fIPerl::Tidy\fR\|(3) .SH "VERSION" .IX Header "VERSION" -This man page documents perltidy version 20130922. +This man page documents perltidy version 20140328. .SH "CREDITS" .IX Header "CREDITS" Michael Cartmell supplied code for adaptation to \s-1VMS\s0 and helped with diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 1d55572..c326a8f 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -3,7 +3,7 @@ # # perltidy - a perl script indenter and formatter # -# Copyright (c) 2000-2013 by Steve Hancock +# Copyright (c) 2000-2014 by Steve Hancock # Distributed under the GPL license agreement; see file COPYING # # This program is free software; you can redistribute it and/or modify @@ -76,9 +76,10 @@ use Cwd; use IO::File; use File::Basename; use File::Copy; +use File::Temp qw(tempfile); BEGIN { - ( $VERSION = q($Id: Tidy.pm,v 1.74 2013/09/22 13:56:49 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker + ( $VERSION = q($Id: Tidy.pm,v 1.74 2014/03/28 13:56:49 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker } sub streamhandle { @@ -235,36 +236,6 @@ sub catfile { return undef; } -sub make_temporary_filename { - - # Make a temporary filename. - # The POSIX tmpnam() function has been unreliable for non-unix systems - # (at least for the win32 systems that I've tested), so use a pre-defined - # name for them. A disadvantage of this is that two perltidy - # runs in the same working directory may conflict. However, the chance of - # that is small and manageable by the user, especially on systems for which - # the POSIX tmpnam function doesn't work. - my $name = "perltidy.TMP"; - if ( $^O =~ /win32|dos/i || $^O eq 'VMS' || $^O eq 'MacOs' ) { - return $name; - } - eval "use POSIX qw(tmpnam)"; - if ($@) { return $name } - use IO::File; - - # just make a couple of tries before giving up and using the default - for ( 0 .. 3 ) { - my $tmpname = tmpnam(); - my $fh = IO::File->new( $tmpname, O_RDWR | O_CREAT | O_EXCL ); - if ($fh) { - $fh->close(); - return ($tmpname); - last; - } - } - return ($name); -} - # Here is a map of the flow of data from the input source to the output # line sink: # @@ -621,30 +592,32 @@ EOM my $in_place_modify = $rOpts->{'backup-and-modify-in-place'} && $rOpts->{'format'} eq 'tidy'; - # turn off -b with warnings in case of conflicts with other options + # Turn off -b with warnings in case of conflicts with other options. + # NOTE: Do this silently, without warnings, if there is a source or + # destination stream, or standard output is used. This is because the -b + # flag may have been in a .perltidyrc file and warnings break + # Test::NoWarnings. See email discussion with Merijn Brand 26 Feb 2014. if ($in_place_modify) { if ( $rOpts->{'standard-output'} ) { - my $msg = "Ignoring -b; you may not use -b and -st together"; - $msg .= " (-pbp contains -st; see manual)" if ($saw_pbp); - Warn "$msg\n"; +## my $msg = "Ignoring -b; you may not use -b and -st together"; +## $msg .= " (-pbp contains -st; see manual)" if ($saw_pbp); +## Warn "$msg\n"; $in_place_modify = 0; } if ($destination_stream) { - Warn -"Ignoring -b; you may not specify a destination stream and -b together\n"; + ##Warn "Ignoring -b; you may not specify a destination stream and -b together\n"; $in_place_modify = 0; } if ( ref($source_stream) ) { - Warn -"Ignoring -b; you may not specify a source array and -b together\n"; + ##Warn "Ignoring -b; you may not specify a source array and -b together\n"; $in_place_modify = 0; } if ( $rOpts->{'outfile'} ) { - Warn "Ignoring -b; you may not use -b and -o together\n"; + ##Warn "Ignoring -b; you may not use -b and -o together\n"; $in_place_modify = 0; } if ( defined( $rOpts->{'output-path'} ) ) { - Warn "Ignoring -b; you may not use -b and -opath together\n"; + ##Warn "Ignoring -b; you may not use -b and -opath together\n"; $in_place_modify = 0; } } @@ -709,6 +682,13 @@ EOM #--------------------------------------------------------------- if ($source_stream) { $fileroot = "perltidy"; + + # If the source is from an array or string, then .LOG output + # is only possible if a logfile stream is specified. This prevents + # unexpected perltidy.LOG files. + if ( !defined($logfile_stream) ) { + $logfile_stream = Perl::Tidy::DevNull->new(); + } } elsif ( $input_file eq '-' ) { # '-' indicates input from STDIN $fileroot = "perltidy"; # root name to use for .ERR, .LOG, etc @@ -1324,12 +1304,7 @@ sub get_stream_as_named_file { my ( $fh_stream, $fh_name ) = Perl::Tidy::streamhandle( $stream, 'r' ); if ($fh_stream) { - my ( $fout, $tmpnam ); - - # TODO: fix the tmpnam routine to return an open filehandle - $tmpnam = Perl::Tidy::make_temporary_filename(); - $fout = IO::File->new( $tmpnam, 'w' ); - + my ( $fout, $tmpnam ) = tempfile(); if ($fout) { $fname = $tmpnam; $is_tmpfile = 1; @@ -2516,23 +2491,11 @@ sub check_options { } } - # see if user set a non-negative logfile-gap + # setting a non-negative logfile gap causes logfile to be saved if ( defined( $rOpts->{'logfile-gap'} ) && $rOpts->{'logfile-gap'} >= 0 ) { - - # a zero gap will be taken as a 1 - if ( $rOpts->{'logfile-gap'} == 0 ) { - $rOpts->{'logfile-gap'} = 1; - } - - # setting a non-negative logfile gap causes logfile to be saved $rOpts->{'logfile'} = 1; } - # not setting logfile gap, or setting it negative, causes default of 50 - else { - $rOpts->{'logfile-gap'} = 50; - } - # set short-cut flag when only indentation is to be done. # Note that the user may or may not have already set the # indent-only flag. @@ -3337,7 +3300,7 @@ sub show_version { print STDOUT <<"EOM"; This is perltidy, v$VERSION -Copyright 2000-2013, Steve Hancock +Copyright 2000-2014, Steve Hancock Perltidy is free software and may be copied under the terms of the GNU General Public License, which is included in the distribution files. @@ -4114,8 +4077,15 @@ sub new { if ( -e $warning_file ) { unlink($warning_file) } } + my $logfile_gap = + defined( $rOpts->{'logfile-gap'} ) + ? $rOpts->{'logfile-gap'} + : 50; + if ( $logfile_gap == 0 ) { $logfile_gap = 1 } + bless { _log_file => $log_file, + _logfile_gap => $logfile_gap, _rOpts => $rOpts, _fh_warnings => $fh_warnings, _last_input_line_written => 0, @@ -4194,7 +4164,7 @@ sub black_box { if ( ( ( $input_line_number - $last_input_line_written ) >= - $rOpts->{'logfile-gap'} + $self->{_logfile_gap} ) || ( $input_line =~ /^\s*(sub|package)\s+(\w+)/ ) ) @@ -4387,6 +4357,7 @@ sub warning { if ( $self->get_use_prefix() > 0 ) { my $input_line_number = Perl::Tidy::Tokenizer::get_input_line_number(); + if ( !defined($input_line_number) ) { $input_line_number = -1 } $fh_warnings->print("$input_line_number:\t@_"); $self->write_logfile_entry("WARNING: @_"); } @@ -4509,7 +4480,7 @@ sub finish { } if ( $self->{_saw_brace_error} - && ( $rOpts->{'logfile-gap'} > 1 || !$save_logfile ) ) + && ( $self->{_logfile_gap} > 1 || !$save_logfile ) ) { $self->warning("To save a full .LOG file rerun with -g\n"); } @@ -5157,16 +5128,7 @@ sub pod_to_html { } # Pod::Html requires a real temporary filename - # If we are making a frame, we have a name available - # Otherwise, we have to fine one - my $tmpfile; - if ( $rOpts->{'frames'} ) { - $tmpfile = $self->{_toc_filename}; - } - else { - $tmpfile = Perl::Tidy::make_temporary_filename(); - } - my $fh_tmp = IO::File->new( $tmpfile, 'w' ); + my ( $fh_tmp, $tmpfile ) = tempfile(); unless ($fh_tmp) { Perl::Tidy::Warn "unable to open temporary file $tmpfile; cannot use pod2html\n"; @@ -15402,9 +15364,7 @@ sub pad_array_to_go { # 3 - ignore => # 4 - always open up if vt=0 # 5 - stable: even for one line blocks if vt=0 - if ( - !$is_long_term - ##BUBBA: TYPO && $tokens_to_go[$i_opening] =~ /^[\(\{\]L]$/ + if ( !$is_long_term && $tokens_to_go[$i_opening] =~ /^[\(\{\[]$/ && $index_before_arrow[ $depth + 1 ] > 0 && !$opening_vertical_tightness{ $tokens_to_go[$i_opening] } @@ -15826,7 +15786,18 @@ sub pad_array_to_go { # don't break pointer calls, such as the following: # File::Spec->curdir => 1, # (This is tokenized as adjacent 'w' tokens) - if ( $tokens_to_go[ $ibreak + 1 ] !~ /^->/ ) { + ##if ( $tokens_to_go[ $ibreak + 1 ] !~ /^->/ ) { + + # And don't break before a comma, as in the following: + # ( LONGER_THAN,=> 1, + # EIGHTY_CHARACTERS,=> 2, + # CAUSES_FORMATTING,=> 3, + # LIKE_THIS,=> 4, + # ); + # This example is for -tso but should be general rule + if ( $tokens_to_go[ $ibreak + 1 ] ne '->' + && $tokens_to_go[ $ibreak + 1 ] ne ',' ) + { set_forced_breakpoint($ibreak); } } ## end if ( $types_to_go[$ibreak...]) @@ -17884,7 +17855,7 @@ sub undo_forced_breakpoint_stack { && ( $iend_2 - $ibeg_2 <= 7 ) ) ); -##BUBBA: RT #81854 +##X: RT #81854 $forced_breakpoint_to_go[$iend_1] = 0 unless $old_breakpoint_to_go[$iend_1]; } @@ -24226,6 +24197,7 @@ sub prepare_for_a_new_file { ';' => sub { $context = UNKNOWN_CONTEXT; $statement_type = ''; + $want_paren = ""; # /^(for|foreach)$/ if ( $is_for_foreach{ $paren_type[$paren_depth] } ) @@ -25554,15 +25526,32 @@ EOM # various quote operators elsif ( $is_q_qq_qw_qx_qr_s_y_tr_m{$tok} ) { +##NICOL PATCH if ( $expecting == OPERATOR ) { - # patch for paren-less for/foreach glitch, part 1 - # perl will accept this construct as valid: + # Be careful not to call an error for a qw quote + # where a parenthesized list is allowed. For example, + # it could also be a for/foreach construct such as # # foreach my $key qw\Uno Due Tres Quadro\ { # print "Set $key\n"; # } - unless ( $tok eq 'qw' && $is_for_foreach{$want_paren} ) + # + + # Or it could be a function call. + # NOTE: Braces in something like &{ xxx } are not + # marked as a block, we might have a method call. + # &method(...), $method->(..), &{method}(...), + # $ref[2](list) is ok & short for $ref[2]->(list) + # + # See notes in 'sub code_block_type' and + # 'sub is_non_structural_brace' + + unless ( + $tok eq 'qw' + && ( $last_nonblank_token =~ /^([\]\}\&]|\-\>)/ + || $is_for_foreach{$want_paren} ) + ) { error_if_expecting_OPERATOR(); } @@ -26819,9 +26808,10 @@ sub code_block_type { # NOTE: braces after type characters start code blocks, but for # simplicity these are not identified as such. See also # sub is_non_structural_brace. - # elsif ( $last_nonblank_type eq 't' ) { - # return $last_nonblank_token; - # } + +## elsif ( $last_nonblank_type eq 't' ) { +## return $last_nonblank_token; +## } # brace after label: elsif ( $last_nonblank_type eq 'J' ) { @@ -27038,7 +27028,8 @@ sub is_non_structural_brace { # NOTE: braces after type characters start code blocks, but for # simplicity these are not identified as such. See also # sub code_block_type - # if ($last_nonblank_type eq 't') {return 0} + + ##if ($last_nonblank_type eq 't') {return 0} # otherwise, it is non-structural if it is decorated # by type information. diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 4a2e263..54af086 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -111,11 +111,10 @@ parameter is ignored. =item logfile -The B parameter allows the calling program to capture -the stream that would otherwise go to a .LOG file. This -stream is only created if requested with a B<-g> parameter. It -contains detailed diagnostic information about a script -which may be useful for debugging. +The B parameter allows the calling program to capture the log stream. +This stream is only created if requested with a B<-g> parameter. It contains +detailed diagnostic information about a script which may be useful for +debugging. =item argv @@ -416,7 +415,7 @@ to perltidy. =head1 VERSION -This man page documents Perl::Tidy version 20130922. +This man page documents Perl::Tidy version 20140328. =head1 LICENSE -- 2.39.2