Skip Menu |

This queue is for tickets about the Perl-Tidy CPAN distribution.

Report information
The Basics
Id: 68870
Status: resolved
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: peter [...] vereshagin.org
Cc: FANY [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 20101217
Fixed in: (no value)

Attachments
0001-Patch-to-format-new-5.14-regex-modifiers-correctly.-.patch
0012-add-5.14-regex-modifiers.patch
perl-tidy-patch514regex.log



Subject: /r for s/// : s///r for Perl-5.14
perltidy inserts the unwanted space before /r modifier for s/// operator. $ rm ~/.perltidyrc $ echo 's///r;' | perl -c - syntax OK $ echo 's///r;' | perltidy | perl -c Bareword found where operator expected at - line 1, near "s/// r" syntax error at - line 1, near "s/// r" - had compilation errors. Versions are below === Summary of my perl5 (revision 5 version 14 subversion 0) configuration: Platform: osname=freebsd, osvers=7.4-stable, archname=i386-freebsd-multi-64int uname='freebsd screwed.box 7.4-stable freebsd 7.4-stable #10: mon may 2 16:12:55 msd 2011 usr@teh.ost:cfg i386 ' config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.14.0/mach -Dprivlib=/usr/local/lib/perl5/5.14.0 -Dman3dir=/usr/local/lib/perl5/5.14.0/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.14.0/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.14.0 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.14.0/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.14.0/BSDPAN" -Doptimize=-g -DDEBUGGING -Di_gdbm -Dusethreads=n -Dusemymalloc=y -Duse64bitint -Dusemultiplicity=y -Dusesitecustomize' hint=previous, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.14.0/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include', optimize='-g', cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.14.0/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DAPPLLIB_EXP="/usr/local/lib/perl5/5.14.0/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -Wl,-E -fstack-protector -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lm -lcrypt -lutil perllibs=-lm -lcrypt -lutil libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.14.0/mach/CORE' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY MYMALLOC PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_TRACK_MEMPOOL USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under freebsd Compiled at May 19 2011 18:36:50 @INC: /usr/local/lib/perl5/5.14.0/BSDPAN /usr/local/lib/perl5/site_perl/5.14.0/mach /usr/local/lib/perl5/site_perl/5.14.0 /usr/local/lib/perl5/5.14.0/mach /usr/local/lib/perl5/5.14.0 .
Attached is a patch that adds support the new Perl 5.14 regex modifiers and a test file. Best, Mark
Subject: 0001-Patch-to-format-new-5.14-regex-modifiers-correctly.-.patch
From f23c25ca0a1d5deeb1257bff8eb1ebc25fd74a61 Mon Sep 17 00:00:00 2001 From: Mark Grimes <mgrimes@cpan.org> Date: Fri, 5 Aug 2011 16:22:49 -0400 Subject: [PATCH] Patch to format new 5.14 regex modifiers correctly. RT Bug #68870. --- lib/Perl/Tidy.pm | 7 +++-- t/test514regex.t | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 t/test514regex.t diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 35cea35..2665edd 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -23295,12 +23295,13 @@ sub prepare_for_a_new_file { # ref: camel 3 p 147, # but perl may accept undocumented flags # perl 5.10 adds 'p' (preserve) + # perl 5.14 adds 'radlu' my %quote_modifiers = ( - 's' => '[cegimosxp]', + 's' => '[cegimosxpradlu]', 'y' => '[cds]', 'tr' => '[cds]', - 'm' => '[cgimosxp]', - 'qr' => '[imosxp]', + 'm' => '[cgimosxpadlu]', + 'qr' => '[imosxpadlu]', 'q' => "", 'qq' => "", 'qw' => "", diff --git a/t/test514regex.t b/t/test514regex.t new file mode 100644 index 0000000..cf149e2 --- /dev/null +++ b/t/test514regex.t @@ -0,0 +1,60 @@ +use strict; +use Test; +use Carp; +BEGIN {plan tests => 1} +use Perl::Tidy; + +#---------------------------------------------------------------------- +## test handling of 5.14 regex modifiers +# RT Bug #68870 +#---------------------------------------------------------------------- +my $source = <<'EOM'; +my $str = +"One Two"; +my $new = $str =~ s/One/Three/gr; +$new = $str =~ s/One/Three/r; +$new = $str =~ s/One/Three/a; +$new = $str =~ s/One/Three/d; +$new = $str =~ s/One/Three/l; +$new = $str =~ s/One/Three/u; +EOM + +my @tidy_output; + +Perl::Tidy::perltidy( + source => \$source, + destination => \@tidy_output, + perltidyrc => undef, + ## argv => '-nsyn -ce -npro -l=60', +); + +my @expected_output=<DATA>; +my $ok=1; +if (@expected_output == @tidy_output) { + while ( $_ = pop @tidy_output ) { + my $expect = pop @expected_output; + if ( $expect ne $_ ) { + print STDERR "got:$_"; + print STDERR "---\n"; + print STDERR "expected_output:$expect"; + $ok=0; + last; + } + } +} +else { + print STDERR "Line Counts differ\n"; + $ok=0; +} +ok ($ok,1); + +# This is the expected result of 'perltidy -ce -l=60' on the above string: + +__DATA__ +my $str = "One Two"; +my $new = $str =~ s/One/Three/gr; +$new = $str =~ s/One/Three/r; +$new = $str =~ s/One/Three/a; +$new = $str =~ s/One/Three/d; +$new = $str =~ s/One/Three/l; +$new = $str =~ s/One/Three/u; -- 1.7.6
Subject: Re: [rt.cpan.org #68870] /r for s/// : s///r for Perl-5.14
Date: Sun, 7 Aug 2011 09:02:35 +0400
To: Mark Grimes via RT <bug-Perl-Tidy [...] rt.cpan.org>
From: Peter Vereshagin <peter [...] vereshagin.org>
You can't take no for an answer, Mark! 2011/08/05 16:26:42 -0400 Mark Grimes via RT <bug-Perl-Tidy@rt.cpan.org> => To peter@vereshagin.org : Show quoted text
MGvR> <URL: https://rt.cpan.org/Ticket/Display.html?id=68870 > MGvR> Attached is a patch that adds support the new Perl 5.14 regex modifiers and a test file.
Attached is a patch testing log. I wish I knew about hunks' offsets on patching. Cause Hunk #1 succeeded at 23295 sounds too many lines offset to me. But think it's all good enough. Thank you! 73! Peter pgp: A0E26627 (4A42 6841 2871 5EA7 52AB 12F8 0CE1 4AAC A0E2 6627) -- http://vereshagin.org

Message body is not shown because sender requested not to inline it.

Download (untitled)
application/pgp-signature 196b

Message body not shown because it is not plain text.

From: ilyuha1 [...] mail.ru
Hi. When the patch will be applied and new release will be available?
RT-Send-CC: mgrimes [...] cpan.org
On Fri Aug 05 16:26:41 2011, MGRIMES wrote: Show quoted text
> Attached is a patch that adds support the new Perl 5.14 regex > modifiers and a test file.
I just happened to notice this ticket. y/// and tr/// support /r as well, and that patch does not address that.
Subject: Re: [rt.cpan.org #68870] /r for s/// : s///r for Perl-5.14
Date: Mon, 2 Jan 2012 21:29:34 -0500
To: bug-Perl-Tidy [...] rt.cpan.org
From: Mark Grimes <mgrimes [...] cpan.org>
<URL: https://rt.cpan.org/Ticket/Display.html?id=68870 > On Tue, Dec 27, 2011 at 11:24 AM, Father Chrysostomos via RT <bug-Perl-Tidy@rt.cpan.org> wrote: Show quoted text
> > I just happened to notice this ticket.  y/// and tr/// support /r as well, and that patch does not > address that.
Ok. This revised patch addresses new 5.14 modifiers for s, m, qr, y and t.

Message body is not shown because sender requested not to inline it.

Please, please, please apply this patch. I'd be happy to do a quick release if you want help.
corrected in version 20120619