Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-PPIx-QuoteLike for openSUSE:Factory checked in at 2022-09-27 20:14:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-PPIx-QuoteLike (Old) and /work/SRC/openSUSE:Factory/.perl-PPIx-QuoteLike.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-PPIx-QuoteLike" Tue Sep 27 20:14:41 2022 rev:18 rq:1006448 version:0.023 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-PPIx-QuoteLike/perl-PPIx-QuoteLike.changes 2022-04-25 23:35:45.566435966 +0200 +++ /work/SRC/openSUSE:Factory/.perl-PPIx-QuoteLike.new.2275/perl-PPIx-QuoteLike.changes 2022-09-27 20:14:54.069954461 +0200 @@ -1,0 +2,13 @@ +Sat Sep 17 03:07:18 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 0.023 + see /usr/share/doc/packages/perl-PPIx-QuoteLike/Changes + + 0.023 2022-09-16 T. R. Wyant + Update discouragement notice for variables(), and add a TODO in + t/variables.t for why. + + Correct normalization of ${^FOO} for PPI. If the caret is present + the braces are not removed. + +------------------------------------------------------------------- Old: ---- PPIx-QuoteLike-0.022.tar.gz New: ---- PPIx-QuoteLike-0.023.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-PPIx-QuoteLike.spec ++++++ --- /var/tmp/diff_new_pack.9uTeVB/_old 2022-09-27 20:14:54.565955541 +0200 +++ /var/tmp/diff_new_pack.9uTeVB/_new 2022-09-27 20:14:54.569955550 +0200 @@ -18,7 +18,7 @@ %define cpan_name PPIx-QuoteLike Name: perl-PPIx-QuoteLike -Version: 0.022 +Version: 0.023 Release: 0 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Parse Perl string literals and string-literal-like things ++++++ PPIx-QuoteLike-0.022.tar.gz -> PPIx-QuoteLike-0.023.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/Changes new/PPIx-QuoteLike-0.023/Changes --- old/PPIx-QuoteLike-0.022/Changes 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/Changes 2022-09-16 15:15:25.000000000 +0200 @@ -1,3 +1,10 @@ +0.023 2022-09-16 T. R. Wyant + Update discouragement notice for variables(), and add a TODO in + t/variables.t for why. + + Correct normalization of ${^FOO} for PPI. If the caret is present + the braces are not removed. + 0.022 2022-04-15 T. R. Wyant Remove 'postderef' argument to new(). Postfix dereference is always recognized. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/MANIFEST new/PPIx-QuoteLike-0.023/MANIFEST --- old/PPIx-QuoteLike-0.022/MANIFEST 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/MANIFEST 2022-09-16 15:15:25.000000000 +0200 @@ -48,3 +48,4 @@ xt/author/pod_links.t xt/author/pod_spelling.t xt/author/prereq.t +xt/author/verbatim.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/META.json new/PPIx-QuoteLike-0.023/META.json --- old/PPIx-QuoteLike-0.022/META.json 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/META.json 2022-09-16 15:15:25.000000000 +0200 @@ -57,51 +57,51 @@ "provides" : { "PPIx::QuoteLike" : { "file" : "lib/PPIx/QuoteLike.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Constant" : { "file" : "lib/PPIx/QuoteLike/Constant.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Dumper" : { "file" : "lib/PPIx/QuoteLike/Dumper.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token" : { "file" : "lib/PPIx/QuoteLike/Token.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Control" : { "file" : "lib/PPIx/QuoteLike/Token/Control.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Delimiter" : { "file" : "lib/PPIx/QuoteLike/Token/Delimiter.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Interpolation" : { "file" : "lib/PPIx/QuoteLike/Token/Interpolation.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::String" : { "file" : "lib/PPIx/QuoteLike/Token/String.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Structure" : { "file" : "lib/PPIx/QuoteLike/Token/Structure.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Unknown" : { "file" : "lib/PPIx/QuoteLike/Token/Unknown.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Token::Whitespace" : { "file" : "lib/PPIx/QuoteLike/Token/Whitespace.pm", - "version" : "0.022" + "version" : "0.023" }, "PPIx::QuoteLike::Utils" : { "file" : "lib/PPIx/QuoteLike/Utils.pm", - "version" : "0.022" + "version" : "0.023" } }, "release_status" : "stable", @@ -119,6 +119,6 @@ "web" : "https://github.com/trwyant/perl-PPIx-QuoteLike" } }, - "version" : "0.022", - "x_serialization_backend" : "JSON::PP version 4.08" + "version" : "0.023", + "x_serialization_backend" : "JSON::PP version 4.11" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/META.yml new/PPIx-QuoteLike-0.023/META.yml --- old/PPIx-QuoteLike-0.022/META.yml 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/META.yml 2022-09-16 15:15:25.000000000 +0200 @@ -25,40 +25,40 @@ provides: PPIx::QuoteLike: file: lib/PPIx/QuoteLike.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Constant: file: lib/PPIx/QuoteLike/Constant.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Dumper: file: lib/PPIx/QuoteLike/Dumper.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token: file: lib/PPIx/QuoteLike/Token.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Control: file: lib/PPIx/QuoteLike/Token/Control.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Delimiter: file: lib/PPIx/QuoteLike/Token/Delimiter.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Interpolation: file: lib/PPIx/QuoteLike/Token/Interpolation.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::String: file: lib/PPIx/QuoteLike/Token/String.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Structure: file: lib/PPIx/QuoteLike/Token/Structure.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Unknown: file: lib/PPIx/QuoteLike/Token/Unknown.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Token::Whitespace: file: lib/PPIx/QuoteLike/Token/Whitespace.pm - version: '0.022' + version: '0.023' PPIx::QuoteLike::Utils: file: lib/PPIx/QuoteLike/Utils.pm - version: '0.022' + version: '0.023' requires: Carp: '0' Encode: '0' @@ -78,5 +78,5 @@ bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike license: http://dev.perl.org/licenses/ repository: git://github.com/trwyant/perl-PPIx-QuoteLike.git -version: '0.022' +version: '0.023' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/eg/pqldump new/PPIx-QuoteLike-0.023/eg/pqldump --- old/PPIx-QuoteLike-0.022/eg/pqldump 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/eg/pqldump 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use Pod::Usage; use PPIx::QuoteLike::Dumper; -our $VERSION = '0.022'; +our $VERSION = '0.023'; my %opt; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/eg/variables new/PPIx-QuoteLike-0.023/eg/variables --- old/PPIx-QuoteLike-0.022/eg/variables 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/eg/variables 2022-09-16 15:15:25.000000000 +0200 @@ -10,7 +10,7 @@ use PPI::Document; use PPIx::QuoteLike::Utils qw{ __variables }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; my %opt; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/inc/My/Module/Recommend/Any.pm new/PPIx-QuoteLike-0.023/inc/My/Module/Recommend/Any.pm --- old/PPIx-QuoteLike-0.022/inc/My/Module/Recommend/Any.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/inc/My/Module/Recommend/Any.pm 2022-09-16 15:15:25.000000000 +0200 @@ -12,7 +12,7 @@ BEGIN { *import = \&Exporter::import; } -our $VERSION = '0.022'; +our $VERSION = '0.023'; our @EXPORT_OK = qw{ __any }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Constant.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Constant.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Constant.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Constant.pm 2022-09-16 15:15:25.000000000 +0200 @@ -8,7 +8,7 @@ use Carp; use base qw{ Exporter }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; no warnings qw{ once }; # For older Perls. @@ -55,12 +55,15 @@ }; }; -# Location constants. Must align with PPI +# The '## VERBATIM' annotations support test xt/author/verbatim.t +## VERBATIM EXPECT 1 +## VERBATIM BEGIN PPI::Document use constant LOCATION_LINE => 0; use constant LOCATION_CHARACTER => 1; use constant LOCATION_COLUMN => 2; use constant LOCATION_LOGICAL_LINE => 3; use constant LOCATION_LOGICAL_FILE => 4; +## VERBATIM END use constant MINIMUM_PERL => '5.000'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Dumper.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Dumper.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Dumper.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Dumper.pm 2022-09-16 15:15:25.000000000 +0200 @@ -12,7 +12,7 @@ use PPIx::QuoteLike::Utils qw{ __instance }; use Scalar::Util (); -our $VERSION = '0.022'; +our $VERSION = '0.023'; use constant SCALAR_REF => ref \0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Control.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Control.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Control.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Control.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; { # TODO make this a state variable when we can require Perl 5.10. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Delimiter.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Delimiter.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Delimiter.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Delimiter.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ MINIMUM_PERL @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; # Perl 5.29.0 disallows unassigned code points and combining code points # as delimiters. Unfortunately for me non-characters and illegal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Interpolation.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Interpolation.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Interpolation.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Interpolation.pm 2022-09-16 15:15:25.000000000 +0200 @@ -20,7 +20,7 @@ use base qw{ PPIx::QuoteLike::Token }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; sub ppi { my ( $self ) = @_; @@ -131,16 +131,18 @@ say "Interpolates $_" for $elem->variables(); -This convenience method returns all interpolated variables. Each is -returned only once, and they are returned in no particular order. - B<NOTE> that this method is discouraged, and may well be deprecated and -removed. My problem with it is that it returns variable names rather -than L<PPI::Element|PPI::Element> objects, leaving you no idea how the -variables are used. It was originally written for the benefit of +removed. I have two problems with it. The first is that it returns +variable names rather than L<PPI::Element|PPI::Element> objects, leaving +you no idea how the variables are used. The second is that it does not +properly handle things like C<"${^CAPTURE[0]}">, and it seems infeasible +to make it do so. It was originally written for the benefit of L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>, but has proven inadequate to that policy's needs. +This convenience method returns all interpolated variables. Each is +returned only once, and they are returned in no particular order. + =head1 SEE ALSO L<PPIx::QuoteLike::Token|PPIx::QuoteLike::Token>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/String.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/String.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/String.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/String.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Structure.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Structure.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Structure.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Structure.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Unknown.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Unknown.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Unknown.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Unknown.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Whitespace.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Whitespace.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token/Whitespace.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token/Whitespace.pm 2022-09-16 15:15:25.000000000 +0200 @@ -9,7 +9,7 @@ use PPIx::QuoteLike::Constant qw{ @CARP_NOT }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; sub significant { return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Token.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Token.pm 2022-09-16 15:15:25.000000000 +0200 @@ -16,7 +16,7 @@ visual_column_number }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; # Private to this package. sub __new { @@ -286,9 +286,11 @@ say "Interpolates $_" for $elem->variables(); B<NOTE> that this method is discouraged, and may well be deprecated and -removed. My problem with it is that it returns variable names rather -than L<PPI::Element|PPI::Element> objects, leaving you no idea how the -variables are used. It was originally written for the benefit of +removed. I have two problems with it. The first is that it returns +variable names rather than L<PPI::Element|PPI::Element> objects, leaving +you no idea how the variables are used. The second is that it does not +properly handle things like C<"${^CAPTURE[0]}">, and it seems infeasible +to make it do so. It was originally written for the benefit of L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>, but has proven inadequate to that policy's needs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Utils.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Utils.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike/Utils.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike/Utils.pm 2022-09-16 15:15:25.000000000 +0200 @@ -39,7 +39,7 @@ __variables }; -our $VERSION = '0.022'; +our $VERSION = '0.023'; # Readonly::Scalar my $BRACED_RE => __match_enclosed( LEFT_CURLY ); Readonly::Scalar my $BRACKETED_RE => __match_enclosed( '[' ); # ] @@ -48,8 +48,8 @@ Readonly::Scalar my $SIGIL_AND_CAST_RE => qr/ \$ \# \$* | [\@\$] \$* /smx; # The following is an interpretation of perldata Identifier Parsing for # Perls before 5.10. -Readonly::Scalar my $SYMBOL_NAME_RE => qr/ - \^? (?: +Readonly::Scalar my $NORMAL_SYMBOL_NAME_RE => qr/ + (?: (?: :: )* '? \w+ (?: (?: (?: :: )+ '? | (?: :: )* ' ) \w+ )* (?: :: )* | @@ -57,6 +57,10 @@ ) /smx; +Readonly::Scalar my $SYMBOL_NAME_RE => qr/ + \^ \w+ | $NORMAL_SYMBOL_NAME_RE +/smxo; + sub column_number { my ( $self ) = @_; return ( $self->location() || [] )->[LOCATION_CHARACTER]; @@ -393,7 +397,7 @@ ( local $_ ) = @_; # "@{[ foo() ]}" => 'foo()' - if ( m/ \A \@ [{] \s* ( $BRACKETED_RE ) \s* [}] \z /smx ) { + if ( m/ \A \@ [{] \s* ( $BRACKETED_RE ) \s* [}] \z /smxo ) { $_ = $1; s/ \A [[] \s* //smx; s/ \s* []] \z //smx; @@ -401,7 +405,7 @@ } # "${\( foo() )}" => 'foo()' - if ( m/ \A \$ [{] \s* \\ \s* ( $PARENTHESIZED_RE ) \s* [}] \z /smx ) { + if ( m/ \A \$ [{] \s* \\ \s* ( $PARENTHESIZED_RE ) \s* [}] \z /smox ) { $_ = $1; s/ \A [(] \s* //smx; s/ \s* [)] \z //smx; @@ -409,7 +413,8 @@ } # "${foo}" => '$foo' - m/ \A ( $SIGIL_AND_CAST_RE ) \s* [{] \s* ( $SYMBOL_NAME_RE ) \s* [}] \z /smx + m/ \A ( $SIGIL_AND_CAST_RE ) \s* + [{] \s* ( $NORMAL_SYMBOL_NAME_RE ) \s* [}] \z /smxo and return "$1$2"; # "${foo{bar}}" => '$foo{bar}' @@ -422,7 +427,7 @@ # } # "$ foo->{bar}" => '$foo->{bar}' - if ( m/ \A ( $SIGIL_AND_CAST_RE ) \s+ ( $SYMBOL_NAME_RE ) ( .* ) /smx ) { + if ( m/ \A ( $SIGIL_AND_CAST_RE ) \s+ ( $SYMBOL_NAME_RE ) ( .* ) /smxo ) { return "$1$2$3"; } @@ -624,10 +629,12 @@ say for __variables( PPI::Document->new( \'$foo' ); -B<NOTE> that this subroutine is discouraged, and may well be deprecated -and removed. My problem with it is that it returns variable names rather -than L<PPI::Element|PPI::Element> objects, leaving you no idea how the -variables are used. It was originally written for the benefit of +B<NOTE> that this subroutine is discouraged, and may well be deprecated and +removed. I have two problems with it. The first is that it returns +variable names rather than L<PPI::Element|PPI::Element> objects, leaving +you no idea how the variables are used. The second is that it does not +properly handle things like C<"${^CAPTURE[0]}">, and it seems infeasible +to make it do so. It was originally written for the benefit of L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>, but has proven inadequate to that policy's needs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike.pm new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike.pm --- old/PPIx-QuoteLike-0.022/lib/PPIx/QuoteLike.pm 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/lib/PPIx/QuoteLike.pm 2022-09-16 15:15:25.000000000 +0200 @@ -39,7 +39,7 @@ }; use Scalar::Util (); -our $VERSION = '0.022'; +our $VERSION = '0.023'; use constant CLASS_CONTROL => 'PPIx::QuoteLike::Token::Control'; use constant CLASS_DELIMITER => 'PPIx::QuoteLike::Token::Delimiter'; @@ -1379,9 +1379,11 @@ say "Interpolates $_" for $str->variables(); B<NOTE> that this method is discouraged, and may well be deprecated and -removed. My problem with it is that it returns variable names rather -than L<PPI::Element|PPI::Element> objects, leaving you no idea how the -variables are used. It was originally written for the benefit of +removed. I have two problems with it. The first is that it returns +variable names rather than L<PPI::Element|PPI::Element> objects, leaving +you no idea how the variables are used. The second is that it does not +properly handle things like C<"${^CAPTURE[0]}">, and it seems infeasible +to make it do so. It was originally written for the benefit of L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>, but has proven inadequate to that policy's needs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/t/normalize_interpolation_for_ppi.t new/PPIx-QuoteLike-0.023/t/normalize_interpolation_for_ppi.t --- old/PPIx-QuoteLike-0.022/t/normalize_interpolation_for_ppi.t 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/t/normalize_interpolation_for_ppi.t 2022-09-16 15:15:25.000000000 +0200 @@ -30,6 +30,10 @@ norm( '${ \\ ( foo() ) }', 'foo()' ); +norm( '${^MATCH}', '${^MATCH}' ); + +norm( '${^CAPTURE[0]}', '${^CAPTURE[0]}' ); + done_testing; sub norm { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/t/variables.t new/PPIx-QuoteLike-0.023/t/variables.t --- old/PPIx-QuoteLike-0.022/t/variables.t 2022-04-15 16:07:21.000000000 +0200 +++ new/PPIx-QuoteLike-0.023/t/variables.t 2022-09-16 15:15:25.000000000 +0200 @@ -20,6 +20,13 @@ check_class( q<"foo$bar">, qw< PPIx::QuoteLike $bar > ); +check( q<"${^MATCH}">, qw{ ${^MATCH} } ); + +TODO: { + local $TODO = 'A restriction, probably permanent'; + check( q<"${^CAPTURE[0]}">, qw{ @{^CAPTURE} } ); +} + # Note -- the following was done using the trinary operator rather than # if/else because I hoped that with the former implementation, when I # added tests I would do so correctly. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PPIx-QuoteLike-0.022/xt/author/verbatim.t new/PPIx-QuoteLike-0.023/xt/author/verbatim.t --- old/PPIx-QuoteLike-0.022/xt/author/verbatim.t 1970-01-01 01:00:00.000000000 +0100 +++ new/PPIx-QuoteLike-0.023/xt/author/verbatim.t 2022-09-16 15:15:25.000000000 +0200 @@ -0,0 +1,200 @@ +package main; + +use 5.010; + +use strict; +use warnings; + +use ExtUtils::Manifest qw{ maniread }; +use Module::Load::Conditional qw{ check_install }; +use Test2::V0; + +use constant VERBATIM => '## VERBATIM '; +use constant VERBATIM_END => VERBATIM . 'END'; + +my $manifest = maniread(); + +my %original; + +foreach ( sort keys %{ $manifest } ) { + next unless m| \A lib/ .* [.] pm \z |smx; + + open my $fh, '<', $_ + or die "Unable to open $_: $!"; + + my %context = ( + file_handle => $fh, + file_name => $_, + ); + + while ( <$fh> ) { + + index $_, VERBATIM + and next; + + my ( undef, undef, $kind, $arg ) = split qr< \s+ >smx, $_, 4; + chomp; + defined $kind + or die "Bug - \$kind not defined from '$_'"; + + my $code = __PACKAGE__->can( "verbatim_$kind" ) + or die sprintf '%s %s not recognized', VERBATIM, $kind; + + $code->( $arg, \%context ); + + } + + if ( defined $context{expect} ) { + is $context{count}, $context{expect}, + "$context{file_name} contains expected number of verbatim sections"; + } elsif ( ! $context{count} ) { + SKIP: { + skip "$context{file_name} contains no verbatim sections"; + } + } + +} + +done_testing; + +sub read_verbatim_section { + my ( $context ) = @_; + my $fh = $context->{file_handle}; + my $line = $.; + + my $content = ''; + + local $_ = undef; + while ( <$fh> ) { + index $_, VERBATIM_END + or return $context->{trim} ? trim_text( $content ) : $content; + $content .= $_; + } + + die "Unterminated VERBATIM BEGIN at $context->{file_name} line $line"; +} + +sub slurp_module { + my ( $module, $context ) = @_; + + state $content = {}; + + return $content->{$module} ||= do { + + my $data = check_install( module => $module ) + or die "Module $module not installed"; + + my $content; + local $/ = undef; + open my $fh, '<', $data->{file} + or die "Unable to open $data->{file}: $!"; + $content = <$fh>; + close $fh; + + $context->{trim} + and $content = trim_text( $content ); + + $content; + }; +} + +sub trim_text { + local $_ = $_[0]; + s/ ^ \s+ //mxg; + s/ \s+ $ //mxg; + return $_; +} + +sub verbatim_BEGIN { + my ( $arg, $context ) = @_; + + $context->{count}++; + my ( $module, $comment ) = split qr< \s+ >smx, $arg, 2; + my $line = $.; + my $content = read_verbatim_section( $context ); + + my $name = "$context->{file_name} line $line verbatim section found in $module"; + if ( index( slurp_module( $module, $context ), $content ) >= 0 ) { + pass $name; + } else { + fail $name; + } + + return; +} + +sub verbatim_EXPECT { + my ( $arg, $context ) = @_; + + ( $context->{expect} ) = split qr< \s+ >smx, $arg, 2; + return; +} + +sub verbatim_TRIM { + my ( $arg, $context ) = @_; + $context->{count} + and die "## VERBATIM TRIM must be before first ## VERBATIM BEGIN at $context->{file_name} line $.\n"; + $context->{trim} = $arg || 0; + return; +} + +1; + +=begin comment + +This test ensures that sections of code copied verbatim from other +modules remain consistent with those modules. It checks any .pm file in +the lib/ directory, as determined from the MANIFEST. + +The testing of individual files is driven by annotations in those files. +All annotations must be at the beginning of the line, and start with the +literal string '## VERBATIM '. Annotations are implemented using +subroutines named 'verbatim_*', where the '*' is the third field in the +annotation (counting '##' as the first). For example, '## VERBATIM +BEGIN' is implemented by subroutine verbatim_BEGIN{}. All such +subroutines will be passed the argument of the annotation (the fourth +field, which consists of everything to the end of the input line) and a +reference to a context hash. This context hash may contain the following +keys: + + count - The number of BEGIN blocks found to this point; + expect - The value of the latest EXPECT annotation, if any; + file_handle - The input handle to the file being processed; + file_name - The name of the file being processed. + +The following annotations are currently implemented: + +## VERBATIM BEGIN module-name ... + +This annotation marks the beginning of a verbatim section, which starts +on the next line and continues to the next '## VERBATIM END' annotation. +The module-name is the name of the module from which the section was +copied. This generates a test to ensure that the section actually occurs +in the specified module. Any extra text on the line is ignored. + +## VERBATIM END + +See '## VERBATIM BEGIN' + +## VERBATIM EXPECT number + +This annotation specifies the number of verbatim sections to expect in +the file. The actual test this specifies is done after the entire input +file has been processed. This is optional, but recommended to ensure +that '## VERBATIM' annotations have not been clobbered. + +If specified more than once, the last specification rules. + +## VERBATIM TRIM Boolean-value + +This annotation specifies whether leading and trailing white space +should be ignored. It is a fatal error to specify this after the first +'## VERBATIM BEGIN'. + +If specified more than once, the last specification rules. + +=end comment + +=cut + +# ex: set textwidth=72 :