Hello community,
here is the log from the commit of package perl-PPIx-QuoteLike for
openSUSE:Leap:15.2 checked in at 2020-04-14 14:22:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/perl-PPIx-QuoteLike (Old)
and /work/SRC/openSUSE:Leap:15.2/.perl-PPIx-QuoteLike.new.3248 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-PPIx-QuoteLike"
Tue Apr 14 14:22:22 2020 rev:4 rq:793642 version:0.011
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/perl-PPIx-QuoteLike/perl-PPIx-QuoteLike.changes
2020-03-15 07:12:19.984998253 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.perl-PPIx-QuoteLike.new.3248/perl-PPIx-QuoteLike.changes
2020-04-14 14:24:10.029417166 +0200
@@ -1,0 +2,23 @@
+Wed Apr 1 03:12:16 UTC 2020 - <[email protected]>
+
+- updated to 0.011
+ see /usr/share/doc/packages/perl-PPIx-QuoteLike/Changes
+
+ 0.011 2020-03-31 T. R. Wyant
+ Normalize interpolation before feeding to PPI. This produces a
+ more-easily-analyzed PPI parse.
+
+ The ->variables() method is now discouraged. It was written to support
+ Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter, but turned
+ out to be inadequate for the job.
+
+ Deprecate new() argument postderef. At this stage it is only
+ documented as deprecated. In the first release after October 1 2020
+ it will warn on the first use. Eventually it will be retracted, and
+ postfix dereferences will always be recognized. This is the default
+ behavior now.
+
+ Correct bracket matchers to accept multiple lines. This was, in some
+ cases, causing interpolations to be misclassified as unknown tokens.
+
+-------------------------------------------------------------------
Old:
----
PPIx-QuoteLike-0.010.tar.gz
New:
----
PPIx-QuoteLike-0.011.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-PPIx-QuoteLike.spec ++++++
--- /var/tmp/diff_new_pack.JQfw2P/_old 2020-04-14 14:24:10.321417385 +0200
+++ /var/tmp/diff_new_pack.JQfw2P/_new 2020-04-14 14:24:10.325417387 +0200
@@ -17,7 +17,7 @@
Name: perl-PPIx-QuoteLike
-Version: 0.010
+Version: 0.011
Release: 0
%define cpan_name PPIx-QuoteLike
Summary: Parse Perl string literals and string-literal-like things
@@ -33,9 +33,11 @@
BuildRequires: perl(Module::Build)
BuildRequires: perl(PPI::Document) >= 1.117
BuildRequires: perl(PPI::Dumper) >= 1.117
+BuildRequires: perl(Readonly)
BuildRequires: perl(Test::More) >= 0.88
Requires: perl(PPI::Document) >= 1.117
Requires: perl(PPI::Dumper) >= 1.117
+Requires: perl(Readonly)
%{perl_requires}
%description
++++++ PPIx-QuoteLike-0.010.tar.gz -> PPIx-QuoteLike-0.011.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/Changes
new/PPIx-QuoteLike-0.011/Changes
--- old/PPIx-QuoteLike-0.010/Changes 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/Changes 2020-03-31 14:01:57.000000000 +0200
@@ -1,3 +1,20 @@
+0.011 2020-03-31 T. R. Wyant
+ Normalize interpolation before feeding to PPI. This produces a
+ more-easily-analyzed PPI parse.
+
+ The ->variables() method is now discouraged. It was written to support
+ Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter, but turned
+ out to be inadequate for the job.
+
+ Deprecate new() argument postderef. At this stage it is only
+ documented as deprecated. In the first release after October 1 2020
+ it will warn on the first use. Eventually it will be retracted, and
+ postfix dereferences will always be recognized. This is the default
+ behavior now.
+
+ Correct bracket matchers to accept multiple lines. This was, in some
+ cases, causing interpolations to be misclassified as unknown tokens.
+
0.010 2020-03-09 T. R. Wyant
Remove redundant and poorly-performing code introduced in version
0.009.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/MANIFEST
new/PPIx-QuoteLike-0.011/MANIFEST
--- old/PPIx-QuoteLike-0.010/MANIFEST 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/MANIFEST 2020-03-31 14:01:57.000000000 +0200
@@ -22,11 +22,12 @@
LICENSES/Artistic
LICENSES/Copying
Makefile.PL
-MANIFEST This list of files
+MANIFEST
README
t/basic.t
t/dump.t
t/locations.t
+t/normalize_interpolation_for_ppi.t
t/parse.t
t/unit-adhoc.t
t/variables.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/META.json
new/PPIx-QuoteLike-0.011/META.json
--- old/PPIx-QuoteLike-0.010/META.json 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/META.json 2020-03-31 14:01:57.000000000 +0200
@@ -34,6 +34,7 @@
"List::Util" : "0",
"PPI::Document" : "1.117",
"PPI::Dumper" : "1.117",
+ "Readonly" : "0",
"Scalar::Util" : "0",
"Text::Tabs" : "0",
"base" : "0",
@@ -47,51 +48,51 @@
"provides" : {
"PPIx::QuoteLike" : {
"file" : "lib/PPIx/QuoteLike.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Constant" : {
"file" : "lib/PPIx/QuoteLike/Constant.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Dumper" : {
"file" : "lib/PPIx/QuoteLike/Dumper.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token" : {
"file" : "lib/PPIx/QuoteLike/Token.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Control" : {
"file" : "lib/PPIx/QuoteLike/Token/Control.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Delimiter" : {
"file" : "lib/PPIx/QuoteLike/Token/Delimiter.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Interpolation" : {
"file" : "lib/PPIx/QuoteLike/Token/Interpolation.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::String" : {
"file" : "lib/PPIx/QuoteLike/Token/String.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Structure" : {
"file" : "lib/PPIx/QuoteLike/Token/Structure.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Unknown" : {
"file" : "lib/PPIx/QuoteLike/Token/Unknown.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Token::Whitespace" : {
"file" : "lib/PPIx/QuoteLike/Token/Whitespace.pm",
- "version" : "0.010"
+ "version" : "0.011"
},
"PPIx::QuoteLike::Utils" : {
"file" : "lib/PPIx/QuoteLike/Utils.pm",
- "version" : "0.010"
+ "version" : "0.011"
}
},
"release_status" : "stable",
@@ -109,6 +110,6 @@
"web" : "https://github.com/trwyant/perl-PPIx-QuoteLike"
}
},
- "version" : "0.010",
+ "version" : "0.011",
"x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/META.yml
new/PPIx-QuoteLike-0.011/META.yml
--- old/PPIx-QuoteLike-0.010/META.yml 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/META.yml 2020-03-31 14:01:57.000000000 +0200
@@ -19,40 +19,40 @@
provides:
PPIx::QuoteLike:
file: lib/PPIx/QuoteLike.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Constant:
file: lib/PPIx/QuoteLike/Constant.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Dumper:
file: lib/PPIx/QuoteLike/Dumper.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token:
file: lib/PPIx/QuoteLike/Token.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Control:
file: lib/PPIx/QuoteLike/Token/Control.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Delimiter:
file: lib/PPIx/QuoteLike/Token/Delimiter.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Interpolation:
file: lib/PPIx/QuoteLike/Token/Interpolation.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::String:
file: lib/PPIx/QuoteLike/Token/String.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Structure:
file: lib/PPIx/QuoteLike/Token/Structure.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Unknown:
file: lib/PPIx/QuoteLike/Token/Unknown.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Token::Whitespace:
file: lib/PPIx/QuoteLike/Token/Whitespace.pm
- version: '0.010'
+ version: '0.011'
PPIx::QuoteLike::Utils:
file: lib/PPIx/QuoteLike/Utils.pm
- version: '0.010'
+ version: '0.011'
requires:
Carp: '0'
Encode: '0'
@@ -60,6 +60,7 @@
List::Util: '0'
PPI::Document: '1.117'
PPI::Dumper: '1.117'
+ Readonly: '0'
Scalar::Util: '0'
Text::Tabs: '0'
base: '0'
@@ -71,5 +72,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.010'
+version: '0.011'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/eg/pqldump
new/PPIx-QuoteLike-0.011/eg/pqldump
--- old/PPIx-QuoteLike-0.010/eg/pqldump 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/eg/pqldump 2020-03-31 14:01:57.000000000 +0200
@@ -9,15 +9,15 @@
use Pod::Usage;
use PPIx::QuoteLike::Dumper;
-our $VERSION = '0.010';
+our $VERSION = '0.011';
my %opt;
GetOptions( \%opt,
qw{
encoding=s indent=i locations! margin=i
- perl_version|perl-version! ppi! significant!
- tokens! variables!
+ perl_version|perl-version! ppi! short!
+ significant! tokens! variables!
},
'whitespace!' => sub {
$opt{significant} = !$_[1];
@@ -31,7 +31,7 @@
my @dumper_arg = map { $_ => $opt{$_} } qw{
encoding indent locations margin perl_version ppi
- significant tokens variables
+ short significant tokens variables
};
foreach my $arg ( @ARGV ) {
@@ -104,6 +104,12 @@
The default is C<-noppi>.
+=head2 -short
+
+If this option is asserted, leading C<'PPIx::QuoteLike::'> will be
+removed from the class names in the output.
+
+The default is C<-noshort>.
=head2 -significant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/eg/variables
new/PPIx-QuoteLike-0.011/eg/variables
--- old/PPIx-QuoteLike-0.010/eg/variables 2020-03-09 15:58:51.000000000
+0100
+++ new/PPIx-QuoteLike-0.011/eg/variables 2020-03-31 14:01:57.000000000
+0200
@@ -10,7 +10,7 @@
use PPI::Document;
use PPIx::QuoteLike::Utils qw{ __variables };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
my %opt;
@@ -72,6 +72,9 @@
L<PPIx::QuoteLike::Utils|PPIx::QuoteLike::Utils> subroutine
L<__variables()|PPIx::QuoteLike::Utils/__variables>.
+B<NOTE> that the C<__variables()> subroutine is discouraged, and may be
+deprecated and removed.
+
=head1 AUTHOR
Thomas R. Wyant, III F<wyant at cpan dot org>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/inc/My/Module/Meta.pm
new/PPIx-QuoteLike-0.011/inc/My/Module/Meta.pm
--- old/PPIx-QuoteLike-0.010/inc/My/Module/Meta.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/inc/My/Module/Meta.pm 2020-03-31
14:01:57.000000000 +0200
@@ -62,6 +62,7 @@
'List::Util' => 0,
'PPI::Document' => 1.117,
'PPI::Dumper' => 1.117,
+ 'Readonly' => 0,
'Scalar::Util' => 0,
'Text::Tabs' => 0,
'base' => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/inc/My/Module/Recommend/Any.pm
new/PPIx-QuoteLike-0.011/inc/My/Module/Recommend/Any.pm
--- old/PPIx-QuoteLike-0.010/inc/My/Module/Recommend/Any.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/inc/My/Module/Recommend/Any.pm 2020-03-31
14:01:57.000000000 +0200
@@ -12,7 +12,7 @@
BEGIN {
*import = \&Exporter::import;
}
-our $VERSION = '0.010';
+our $VERSION = '0.011';
our @EXPORT_OK = qw{ __any };
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Constant.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Constant.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Constant.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Constant.pm 2020-03-31
14:01:57.000000000 +0200
@@ -8,7 +8,7 @@
use Carp;
use base qw{ Exporter };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
our @CARP_NOT = qw{
PPIx::QuoteLike
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Dumper.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Dumper.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Dumper.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Dumper.pm 2020-03-31
14:01:57.000000000 +0200
@@ -12,7 +12,7 @@
use PPIx::QuoteLike::Utils qw{ __instance };
use Scalar::Util ();
-our $VERSION = '0.010';
+our $VERSION = '0.011';
use constant SCALAR_REF => ref \0;
@@ -25,6 +25,7 @@
margin => 0,
perl_version => 0,
ppi => 0,
+ short => 0,
significant => 0,
tokens => 0,
variables => 0,
@@ -98,7 +99,7 @@
map { _format_content( $obj, $_ ) }
qw{ type start finish };
push @rslt,
- join "\t", ref $obj, $string,
+ join "\t", $self->_class_name( $obj ), $string,
_format_attr( $obj, qw{ encoding failures interpolates } ),
$self->_perl_version( $obj ),
$self->_variables( $obj ),
@@ -118,7 +119,7 @@
' ' x 19 :
'';
my @line = (
- ref $elem,
+ $self->_class_name( $elem ),
_quote( $elem->content() ),
$self->_perl_version( $elem ),
$self->_variables( $elem ),
@@ -156,6 +157,14 @@
return join '', map { "$margin$_\n" } $self->list();
}
+sub _class_name {
+ my ( $self, $obj ) = @_;
+ my $class = ref $obj;
+ $self->{short}
+ and $class =~ s/ \A PPIx::QuoteLike:: //smx;
+ return $class;
+}
+
{
# We have to hold a reference to the PPI document until we're done
# with all its elements, otherwise they evaporate. Holding it here
@@ -260,17 +269,6 @@
";
}
-=begin comment
-
- $val =~ m/ [{}] /smx
- or return "q{$val}";
- $val =~ m{ / }smx
- or return "q/$val/";
-
-=end comment
-
-=cut
-
$val =~ s/ (?= [\\'] )/\\/smxg;
return "'$val'";
}
@@ -394,6 +392,10 @@
=item postderef Boolean
+B<THIS ARGUMENT IS DEPRECATED>. See L<DEPRECATION
+NOTICE|PPIx::QuoteLike/DEPRECATION NOTICE> in
+L<PPIx::QuoteLike|PPIx::QuoteLike> for the details.
+
This argument specifies whether or not postfix dereferences are
recognized in interpolations. It is passed through to
L<PPIx::QuoteLike|PPIx::QuoteLike> L<new()|PPIx::QuoteLike/new> unless
@@ -407,6 +409,11 @@
The default is C<0> (i.e. false).
+=item short Boolean
+
+If true, leading C<'PPIx::QuoteLike::'> will be removed from the class
+names in the output.
+
=item tokens boolean
If true, this argument causes an unstructured dump of tokens found in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Control.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Control.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Control.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Control.pm
2020-03-31 14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
{
# 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.010/lib/PPIx/QuoteLike/Token/Delimiter.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Delimiter.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Delimiter.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Delimiter.pm
2020-03-31 14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ MINIMUM_PERL @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
# 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.010/lib/PPIx/QuoteLike/Token/Interpolation.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Interpolation.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Interpolation.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Interpolation.pm
2020-03-31 14:01:57.000000000 +0200
@@ -11,14 +11,16 @@
LOCATION_COLUMN
LOCATION_LOGICAL_LINE
LOCATION_LOGICAL_FILE
- VARIABLE_RE
@CARP_NOT
};
-use PPIx::QuoteLike::Utils qw{ __variables };
+use PPIx::QuoteLike::Utils qw{
+ __normalize_interpolation_for_ppi
+ __variables
+};
use base qw{ PPIx::QuoteLike::Token };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
sub ppi {
my ( $self ) = @_;
@@ -36,13 +38,7 @@
$content .= ' ' x ( $location->[LOCATION_COLUMN] - 1 );
}
-## The following code is tempting, but I really, really want to
-## avoid enabling it, because I may hit uses of ${something} that
-## it does not cover.
-## ( $content = $self->content() ) =~
-## s/ \A ( [\$\@] (?: \# \$? | \$* ) )
-## \{ ( @{[ VARIABLE_RE ]} ) \} \z /$1$2/smxo;
- $content .= $self->content();
+ $content .= __normalize_interpolation_for_ppi( $self->content() );
$self->{ppi} = PPI::Document->new( \$content );
@@ -73,14 +69,6 @@
return $self->{ppi};
}
-# For the moment this is package-private and subject to change or
-# retraction without notice. If there is need, it will be made public
-# by stripping the leading underscores and documenting it.
-sub __purge_ppi {
- my ( $self ) = @_;
- return delete $self->{ppi};
-}
-
sub variables {
my ( $self ) = @_;
return __variables( $self->ppi() );
@@ -146,6 +134,13 @@
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
+L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>,
+but has proven inadequate to that policy's needs.
+
=head1 SEE ALSO
L<PPIx::QuoteLike::Token|PPIx::QuoteLike::Token>.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/String.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/String.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/String.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/String.pm 2020-03-31
14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Structure.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Structure.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Structure.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Structure.pm
2020-03-31 14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Unknown.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Unknown.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Unknown.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Unknown.pm
2020-03-31 14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Whitespace.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Whitespace.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token/Whitespace.pm
2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token/Whitespace.pm
2020-03-31 14:01:57.000000000 +0200
@@ -9,7 +9,7 @@
use PPIx::QuoteLike::Constant qw{ @CARP_NOT };
-our $VERSION = '0.010';
+our $VERSION = '0.011';
sub significant {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Token.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Token.pm 2020-03-31
14:01:57.000000000 +0200
@@ -16,7 +16,7 @@
visual_column_number
};
-our $VERSION = '0.010';
+our $VERSION = '0.011';
# Private to this package.
sub __new {
@@ -285,6 +285,13 @@
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
+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.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Utils.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Utils.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike/Utils.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike/Utils.pm 2020-03-31
14:01:57.000000000 +0200
@@ -18,6 +18,7 @@
VARIABLE_RE
@CARP_NOT
};
+use Readonly;
use Scalar::Util ();
use constant LEFT_CURLY => q<{>;
@@ -32,10 +33,30 @@
statement
visual_column_number
__instance
+ __match_enclosed
+ __matching_delimiter
+ __normalize_interpolation_for_ppi
__variables
};
-our $VERSION = '0.010';
+our $VERSION = '0.011';
+
+# Readonly::Scalar my $BRACED_RE => __match_enclosed( LEFT_CURLY );
+Readonly::Scalar my $BRACKETED_RE => __match_enclosed( '[' ); # ]
+Readonly::Scalar my $PARENTHESIZED_RE => __match_enclosed( '(' ); # )
+
+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/
+ \^? (?:
+ (?: :: )* '?
+ \w+ (?: (?: (?: :: )+ '? | (?: :: )* ' ) \w+ )*
+ (?: :: )* |
+ [[:punct:]]
+ )
+/smx;
+
sub column_number {
my ( $self ) = @_;
@@ -322,6 +343,109 @@
return ( $self->location() || [] )->[LOCATION_LOGICAL_LINE];
}
+{
+ our %REGEXP_CACHE;
+
+ my %matching_bracket;
+
+ BEGIN {
+ %matching_bracket = qw/ ( ) [ ] { } < > /;
+ }
+
+ sub __match_enclosed {
+ my ( $left ) = @_;
+ my $ql = quotemeta $left;
+
+ $REGEXP_CACHE{$ql}
+ and return $REGEXP_CACHE{$ql};
+
+ if ( my $right = $matching_bracket{$left} ) {
+
+ # Based on Regexp::Common $RE{balanced} 2.113 (because I
+ # can't use (?-1)
+
+ my $ql = quotemeta $left;
+ my $qr = quotemeta $right;
+ my $pkg = __PACKAGE__;
+ my $r = "(??{ \$${pkg}::REGEXP_CACHE{'$ql'} })";
+
+ my @parts = (
+ "(?>[^\\\\$ql$qr]+)",
+ "(?>\\\$[$ql$qr])",
+ '(?>\\\\.)',
+ $r,
+ );
+
+ {
+ use re qw{ eval };
+ local $" = '|';
+ $REGEXP_CACHE{$ql} = qr/($ql(?:@parts)*$qr)/sm;
+ }
+
+ return $REGEXP_CACHE{$ql};
+
+ } else {
+
+ # Based on Regexp::Common $RE{delimited}{-delim=>'`'}
+ return ( $REGEXP_CACHE{$ql} ||=
+ qr< (?:
+ (?: \Q$left\E )
+ (?: [^\\\Q$left\E]* (?: \\ . [^\\\Q$left\E]* )* )
+ (?: \Q$left\E )
+ ) >smx
+ );
+ }
+ }
+
+ sub __matching_delimiter {
+ my ( $left ) = @_;
+ my $right = $matching_bracket{$left}
+ or return $left;
+ return $right;
+ }
+}
+
+sub __normalize_interpolation_for_ppi {
+ ( local $_ ) = @_;
+
+ # "@{[ foo() ]}" => 'foo()'
+ if ( m/ \A \@ [{] \s* ( $BRACKETED_RE ) \s* [}] \z /smx ) {
+ $_ = $1;
+ s/ \A [[] \s* //smx;
+ s/ \s* []] \z //smx;
+ return "$_";
+ }
+
+ # "${\( foo() )}" => 'foo()'
+ if ( m/ \A \$ [{] \s* \\ \s* ( $PARENTHESIZED_RE ) \s* [}] \z /smx ) {
+ $_ = $1;
+ s/ \A [(] \s* //smx;
+ s/ \s* [)] \z //smx;
+ return "$_";
+ }
+
+ # "${foo}" => '$foo'
+ m/ \A ( $SIGIL_AND_CAST_RE ) \s* [{] \s* ( $SYMBOL_NAME_RE ) \s* [}] \z
/smx
+ and return "$1$2";
+
+ # "${foo{bar}}" => '$foo{bar}'
+ # NOTE that this is a warning, and so not done.
+# if ( m/ \A ( $SIGIL_AND_CAST_RE ) (?= [{] ) ( $BRACED_RE ) /smx ) {
+# ( my $sigil, local $_ ) = ( $1, $2 );
+# s/ \A [{] \s* //smx;
+# s/ \s* [}] \z //smx;
+# return "$sigil$_";
+# }
+
+ # "$ foo->{bar}" => '$foo->{bar}'
+ if ( m/ \A ( $SIGIL_AND_CAST_RE ) \s+ ( $SYMBOL_NAME_RE ) ( .* ) /smx ) {
+ return "$1$2$3";
+ }
+
+ # Everything else
+ return "$_";
+}
+
sub statement {
my ( $self ) = @_;
my $top = $self->top()
@@ -468,6 +592,26 @@
directives into account) of the first character in the element, or
C<undef> if that can not be determined.
+=head2 __normalize_interpolation_for_ppi
+
+Despite the leading underscores, this exportable subroutine is public
+and supported. The underscores are so it will not appear to be public
+code to various tools when imported into other code.
+
+This subroutine takes as its argument a string representing an
+interpolation. It removes such things as braces around variable names to
+make it into more normal Perl -- which is to say Perl that produces a
+more normal L<PPI|PPI> parse. Sample transformations are:
+
+ '${foo}' => '$foo'
+ '@{[ foo() ]}' => 'foo()'
+ '${\( foo() )}' => 'foo()'
+
+B<NOTE> that this is not intended for general code cleanup.
+Specifically, it assumes that its argument is an interpolation and
+B<only> an interpolation. Feeding it anything else is unsupported, and
+probably will not return anything useful.
+
=head2 statement
This subroutine/method returns the L<PPI::Statement|PPI::Statement> that
@@ -497,6 +641,13 @@
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
+L<Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter|Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter>,
+but has proven inadequate to that policy's needs.
+
Despite the leading underscores, this exportable subroutine is public
and supported. The underscores are so it will not appear to be public
code to various tools when imported into other code.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike.pm
new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike.pm
--- old/PPIx-QuoteLike-0.010/lib/PPIx/QuoteLike.pm 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/lib/PPIx/QuoteLike.pm 2020-03-31
14:01:57.000000000 +0200
@@ -34,11 +34,13 @@
statement
visual_column_number
__instance
+ __match_enclosed
+ __matching_delimiter
};
use Scalar::Util ();
use Text::Tabs ();
-our $VERSION = '0.010';
+our $VERSION = '0.011';
use constant CLASS_CONTROL => 'PPIx::QuoteLike::Token::Control';
use constant CLASS_DELIMITER => 'PPIx::QuoteLike::Token::Delimiter';
@@ -58,9 +60,9 @@
$PPIx::QuoteLike::DEFAULT_POSTDEREF = 1;
{
- my $match_sq = _match_enclosed( qw< ' > );
- my $match_dq = _match_enclosed( qw< " > );
- my $match_bt = _match_enclosed( qw< ` > );
+ my $match_sq = __match_enclosed( qw< ' > );
+ my $match_dq = __match_enclosed( qw< " > );
+ my $match_bt = __match_enclosed( qw< ` > );
sub new { ## no critic (RequireArgUnpacking)
my ( $class, $source, %arg ) = @_;
@@ -116,7 +118,7 @@
$self->{interpolates} = 'qq' eq $type ||
'qx' eq $type && q<'> ne $start_delim;
$content = substr $string, ( pos $string || 0 );
- $end_delim = _matching_delimiter( $start_delim );
+ $end_delim = __matching_delimiter( $start_delim );
if ( $end_delim eq substr $content, -1 ) {
chop $content;
} else {
@@ -157,7 +159,7 @@
and warn "Initial match '$type$start_delim'\n";
$self->{interpolates} = q<'> ne $start_delim;
$content = substr $string, ( pos $string || 0 );
- $end_delim = _matching_delimiter( $start_delim );
+ $end_delim = __matching_delimiter( $start_delim );
if ( $end_delim eq substr $content, -1 ) {
chop $content;
} else {
@@ -201,7 +203,7 @@
# otherwise-interpolating string. That is to say,
# "\N{$foo}" is simply invalid, and does not even
# try to interpolate $foo. {
- # TODO use $re = _match_enclosed( '{' ); # }
+ # TODO use $re = __match_enclosed( '{' ); # }
my ( $seq, $name ) = ( $1, $2 );
# TODO The Regexp is certainly too permissive. For
# the moment all I am doing is disallowing
@@ -210,6 +212,10 @@
[ CLASS_UNKNOWN, $seq,
error => "Unknown charname '$name'" ] :
[ CLASS_STRING, $seq ];
+ # NOTE in the following that I do not read perldata as
+ # saying there can be space between the sigil and the
+ # variable name, but Perl itself seems to accept it as
+ # of 5.30.1.
} elsif ( $content =~ m/ \G ( [\$\@] \#? \$* ) /smxgc ) {
push @children, $self->_interpolation( "$1", $content );
} elsif ( $content =~ m/ \G ( \\ . | [^\\\$\@]+ ) /smxgc ) {
@@ -604,7 +610,7 @@
if ( $_[2] =~ m/ \G (?= \{ ) /smxgc ) {
# variable name enclosed in {}
- my $delim_re = _match_enclosed( qw< { > );
+ my $delim_re = __match_enclosed( qw< { > );
$_[2] =~ m/ \G ( $delim_re ) /smxgc
and return [ CLASS_INTERPOLATION, "$sigil$1" ];
$_[2] =~ m/ \G ( .* ) /smxgc
@@ -619,7 +625,7 @@
my $interp = "$sigil$1";
while ( $_[2] =~ m/ \G ( (?: -> )? ) (?= ( [[{] ) ) /smxgc ) { # }]
my $lead_in = $1;
- my $delim_re = _match_enclosed( $2 );
+ my $delim_re = __match_enclosed( $2 );
if ( $_[2] =~ m/ \G ( $delim_re ) /smxgc ) {
$interp .= "$lead_in$1";
} else {
@@ -671,81 +677,6 @@
}
{
- our %REGEXP_CACHE;
-
- my %matching_bracket = qw/ ( ) [ ] { } < > /;
-
- sub _match_enclosed {
- my ( $left ) = @_;
- my $ql = quotemeta $left;
- $REGEXP_CACHE{$ql}
- and return $REGEXP_CACHE{$ql};
- if ( my $right = $matching_bracket{$left} ) {
-
-=begin comment
-
- return ( $REGEXP_CACHE{$left} =
- qr/ (
- \Q$left\E
- (?:
- (?> [^\\\Q$left$right\E]+ ) |
- (?> \$ [\Q$left$right\E] ) |
- (?> \\ . ) |
- (?-1)
- )*
- \Q$right\E
- ) /smx
- );
-
-=end comment
-
-=cut
-
- # Based on Regexp::Common $RE{balanced} 2.113 (because I
- # can't use (?-1)
-
- my $ql = quotemeta $left;
- my $qr = quotemeta $right;
- my $pkg = __PACKAGE__;
- my $r = "(??{ \$${pkg}::REGEXP_CACHE{'$ql'} })";
-
- my @parts = (
- "(?>[^\\\\$ql$qr]+)",
- "(?>\\\$[$ql$qr])",
- '(?>\\\\.)',
- $r,
- );
-
- {
- use re qw{ eval };
- local $" = '|';
- $REGEXP_CACHE{$ql} = qr/($ql(?:@parts)*$qr)/;
- }
-
- return $REGEXP_CACHE{$ql};
-
- } else {
-
- # Based on Regexp::Common $RE{delimited}{-delim=>'`'}
- return ( $REGEXP_CACHE{$ql} ||=
- qr< (?:
- (?: \Q$left\E )
- (?: [^\\\Q$left\E]* (?: \\ . [^\\\Q$left\E]* )* )
- (?: \Q$left\E )
- ) >smx
- );
- }
- }
-
- sub _matching_delimiter {
- my ( $left ) = @_;
- my $right = $matching_bracket{$left}
- or return $left;
- return $right;
- }
-}
-
-{
my %allow_subscr = map { $_ => 1 } qw{ % @ };
# Match a postfix deref at the current position in the argument. If
@@ -766,7 +697,7 @@
$allow_subscr{$sigil} &&
$_[0] =~ m/ \G (?= ( [[{] ) ) /smxgc # }]
) {
- my $re = _match_enclosed( "$1" );
+ my $re = __match_enclosed( "$1" );
$_[0] =~ m/ \G $re /smxgc
and return "$match$1";
}
@@ -859,6 +790,17 @@
interpolated variables for L<Perl::Critic|Perl::Critic> policies and
similar code.
+=head1 DEPRECATION NOTICE
+
+The L<postderef|/postderef> argument to L<new()|/new> is being put
+through a deprecation cycle and retracted. After the retraction, postfix
+dereferences will always be recognized. This is the default behaviour
+now.
+
+Starting with the first release after October 1 2020, the first use of
+this argument will warn. Six months after that all uses will warn. After
+a further six months, all uses will become fatal.
+
=head1 INHERITANCE
C<PPIx::QuoteLike> is not descended from any other class.
@@ -923,6 +865,9 @@
=item postderef
+B<THIS ARGUMENT IS DEPRECATED>.
+See L<DEPRECATION NOTICE|/DEPRECATION NOTICE> above for the details.
+
This Boolean argument determines whether postfix dereferencing is
recognized in interpolation. If unspecified, or specified as C<undef>,
it defaults to the value of C<$PPIx::QuoteLike::DEFAULT_POSTDEREF>. This
@@ -1180,6 +1125,13 @@
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
+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. If the
object does not represent a string that interpolates, nothing is
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/t/locations.t
new/PPIx-QuoteLike-0.011/t/locations.t
--- old/PPIx-QuoteLike-0.010/t/locations.t 2020-03-09 15:58:51.000000000
+0100
+++ new/PPIx-QuoteLike-0.011/t/locations.t 2020-03-31 14:01:57.000000000
+0200
@@ -58,15 +58,9 @@
note q<PPI document corresponding to '${bar}'>;
my $ppi2 = $token[3]->ppi();
@token = $ppi2->tokens();
- cmp_ok scalar @token, '==', 4, 'Interpolation PPI has 4 tokens';
+ cmp_ok scalar @token, '==', 1, 'Interpolation PPI has 1 token';
is_deeply $token[0]->location(), [ 2, 5, 5, 42, 'the_answer' ],
- q<Token 0 ('$') location>;
- is_deeply $token[1]->location(), [ 2, 6, 6, 42, 'the_answer' ],
- q<Token 1 ('{') location>;
- is_deeply $token[2]->location(), [ 2, 7, 7, 42, 'the_answer' ],
- q<Token 2 ('bar') location>;
- is_deeply $token[3]->location(), [ 2, 10, 10, 42, 'the_answer' ],
- q<Token 5 ('}') location>;
+ q<Token 0 ('$bar') location>;
}
done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/PPIx-QuoteLike-0.010/t/normalize_interpolation_for_ppi.t
new/PPIx-QuoteLike-0.011/t/normalize_interpolation_for_ppi.t
--- old/PPIx-QuoteLike-0.010/t/normalize_interpolation_for_ppi.t
1970-01-01 01:00:00.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/t/normalize_interpolation_for_ppi.t
2020-03-31 14:01:57.000000000 +0200
@@ -0,0 +1,48 @@
+package main;
+
+use 5.006;
+
+use strict;
+use warnings;
+
+use PPIx::QuoteLike::Utils qw{ __normalize_interpolation_for_ppi };
+use Test::More 0.88; # Because of done_testing();
+
+sub norm ($$;$);
+
+norm '$foo', '$foo';
+
+norm '$ foo', '$foo';
+
+norm '${foo}', '$foo';
+
+norm '${ foo }', '$foo';
+
+norm '$ { foo }', '$foo';
+
+# NOTE this is a warning, and so (for now) not supported
+# norm '${foo{bar}}', '$foo{bar}';
+
+# NOTE this is a warning, and so (for now) not supported
+# norm '@{foo{bar}}', '@foo{bar}';
+
+norm '@{$x[$i]}', '@{$x[$i]}';
+
+norm '@{ [ foo() ] }', 'foo()';
+
+norm '${ \\ ( foo() ) }', 'foo()';
+
+done_testing;
+
+sub norm ($$;$) {
+ my ( $norm, $want, $title ) = @_;
+ defined $title
+ or $title = "'$norm' normalizes to '$want'";
+ my $got = __normalize_interpolation_for_ppi( $norm );
+ @_ = ( $got, $want, $title );
+ goto &is;
+}
+
+1;
+
+# ex: set textwidth=72 :
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/t/parse.t
new/PPIx-QuoteLike-0.011/t/parse.t
--- old/PPIx-QuoteLike-0.010/t/parse.t 2020-03-09 15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/t/parse.t 2020-03-31 14:01:57.000000000 +0200
@@ -598,144 +598,87 @@
}
}
-$obj = PPIx::QuoteLike->new( <<'__END_OF_HERE_DOCUMENT'
-<< "EOD"
-$foo->{bar}bazzle
-EOD
-__END_OF_HERE_DOCUMENT
- );
-if ( ok $obj, q{Able to parse << "EOD"
-$foo->{bar}bazzle
-EOD
-} ) {
- cmp_ok $obj->failures(), '==', 0, q{Failures parsing << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- cmp_ok $obj->interpolates(), '==', 1, q{Does << "EOD"
-$foo->{bar}bazzle
-EOD
- interpolate};
- is $obj->content(), <<'__END_OF_HERE_DOCUMENT'
+{
+ my $here_doc = <<'__END_OF_HERE_DOCUMENT';
<< "EOD"
$foo->{bar}bazzle
+${\
+ $burfle
+}
EOD
__END_OF_HERE_DOCUMENT
-, q{Can recover << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- is $obj->__get_value( 'type' ), '<<',
- q{Type of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- is $obj->delimiters(), q{"EOD"EOD}, q{Delimiters of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- is $obj->__get_value( 'start' ), q{"EOD"}, q{Start delimiter of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- is $obj->__get_value( 'finish' ), q{EOD}, q{Finish delimiter of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- is $obj->encoding(), undef, q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- encoding};
- is_deeply [ sort $obj->variables() ],
- [ qw{ $foo } ],
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- interpolated variables};
- cmp_ok $obj->postderef(), '==', 1, q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- postderef};
- cmp_ok scalar $obj->elements(), '==', 8,
- q{Number of elements of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- cmp_ok scalar $obj->children(), '==', 2,
- q{Number of children of << "EOD"
-$foo->{bar}bazzle
-EOD
-};
- if ( my $kid = $obj->child( 0 ) ) {
- ok $kid->isa( 'PPIx::QuoteLike::Token::Interpolation' ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 class};
- is $kid->content(), q/$foo->{bar}/,
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 content};
- is $kid->error(), undef,
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 error};
- cmp_ok $kid->parent(), '==', $obj,
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 parent};
- cmp_ok $kid->previous_sibling() || 0, '==', $obj->__kid( 0 - 1 ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 previous sibling};
- cmp_ok $kid->next_sibling() || 0, '==', $obj->__kid( 0 + 1 ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 next sibling};
- is_deeply [ sort $kid->variables() ],
- [ qw{ $foo } ],
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 0 interpolated variables};
- }
- if ( my $kid = $obj->child( 1 ) ) {
- ok $kid->isa( 'PPIx::QuoteLike::Token::String' ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 class};
- is $kid->content(), q{bazzle
-},
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 content};
- is $kid->error(), undef,
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 error};
- cmp_ok $kid->parent(), '==', $obj,
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 parent};
- cmp_ok $kid->previous_sibling() || 0, '==', $obj->__kid( 1 - 1 ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 previous sibling};
- cmp_ok $kid->next_sibling() || 0, '==', $obj->__kid( 1 + 1 ),
- q{<< "EOD"
-$foo->{bar}bazzle
-EOD
- child 1 next sibling};
+
+ $obj = PPIx::QuoteLike->new( $here_doc );
+ if ( ok $obj, q{Able to parse HERE_DOCUMENT} ) {
+ cmp_ok $obj->failures(), '==', 0, q{Failures parsing HERE_DOCUMENT};
+ cmp_ok $obj->interpolates(), '==', 1, q{Does HERE_DOCUMENT interpolate};
+ is $obj->content(), $here_doc, q{Can recover HERE_DOCUMENT};
+ is $obj->__get_value( 'type' ), '<<', q{Type of HERE_DOCUMENT};
+ is $obj->delimiters(), q{"EOD"EOD}, q{Delimiters of HERE_DOCUMENT};
+ is $obj->__get_value( 'start' ), q{"EOD"},
+ q{Start delimiter of HERE_DOCUMENT};
+ is $obj->__get_value( 'finish' ), q{EOD},
+ q{Finish delimiter of HERE_DOCUMENT};
+ is $obj->encoding(), undef, q{Encoding of HERE_DOCUMENT};
+ is_deeply [ sort $obj->variables() ],
+ [ qw{ $burfle $foo } ],
+ q{HERE_DOCUMENT interpolated variables};
+ cmp_ok $obj->postderef(), '==', 1, q{HERE_DOCUMENT postderef};
+ cmp_ok scalar $obj->elements(), '==', 10,
+ q{Number of elements of HERE_DOCUMENT};
+ cmp_ok scalar $obj->children(), '==', 4,
+ q{Number of children of HERE_DOCUMENT};
+
+ if ( my $kid = $obj->child( 0 ) ) {
+ ok $kid->isa( 'PPIx::QuoteLike::Token::Interpolation' ),
+ q{HERE_DOCUMENT child 0 class};
+ is $kid->content(), q/$foo->{bar}/,
+ q{HERE_DOCUMENT child 0 content};
+ is $kid->error(), undef,
+ q{HERE_DOCUMENT child 0 error};
+ cmp_ok $kid->parent(), '==', $obj,
+ q{HERE_DOCUMENT child 0 parent};
+ cmp_ok $kid->previous_sibling() || 0, '==', $obj->__kid( 0 - 1 ),
+ q{HERE_DOCUMENT child 0 previous sibling};
+ cmp_ok $kid->next_sibling() || 0, '==', $obj->__kid( 0 + 1 ),
+ q{HERE_DOCUMENT child 0 next sibling};
+ is_deeply [ sort $kid->variables() ],
+ [ qw{ $foo } ],
+ q{HERE_DOCUMENT child 0 interpolated variables};
+ }
+
+ if ( my $kid = $obj->child( 1 ) ) {
+ ok $kid->isa( 'PPIx::QuoteLike::Token::String' ),
+ q{HERE_DOCUMENT child 1 class};
+ is $kid->content(), qq{bazzle\n},
+ q{HERE_DOCUMENT child 1 content};
+ is $kid->error(), undef,
+ q{HERE_DOCUMENT child 1 error};
+ cmp_ok $kid->parent(), '==', $obj,
+ q{HERE_DOCUMENT child 1 parent};
+ cmp_ok $kid->previous_sibling() || 0, '==', $obj->__kid( 1 - 1 ),
+ q{HERE_DOCUMENT child 1 previous sibling};
+ cmp_ok $kid->next_sibling() || 0, '==', $obj->__kid( 1 + 1 ),
+ q{HERE_DOCUMENT child 1 next sibling};
+ }
+
+ if ( my $kid = $obj->child( 2 ) ) {
+ ok $kid->isa( 'PPIx::QuoteLike::Token::Interpolation' ),
+ q{HERE_DOCUMENT child 2 class};
+ is $kid->content(), "\${\\\n \$burfle\n}",
+ q{HERE_DOCUMENT child 2 content};
+ is $kid->error(), undef,
+ q{HERE_DOCUMENT child 2 error};
+ cmp_ok $kid->parent(), '==', $obj,
+ q{HERE_DOCUMENT child 2 parent};
+ cmp_ok $kid->previous_sibling() || 2, '==', $obj->__kid( 2 - 1 ),
+ q{HERE_DOCUMENT child 2 previous sibling};
+ cmp_ok $kid->next_sibling() || 2, '==', $obj->__kid( 2 + 1 ),
+ q{HERE_DOCUMENT child 2 next sibling};
+ is_deeply [ sort $kid->variables() ],
+ [ qw{ $burfle } ],
+ q{HERE_DOCUMENT child 2 interpolated variables};
+ }
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/PPIx-QuoteLike-0.010/xt/author/pod_spelling.t
new/PPIx-QuoteLike-0.011/xt/author/pod_spelling.t
--- old/PPIx-QuoteLike-0.010/xt/author/pod_spelling.t 2020-03-09
15:58:51.000000000 +0100
+++ new/PPIx-QuoteLike-0.011/xt/author/pod_spelling.t 2020-03-31
14:01:57.000000000 +0200
@@ -22,6 +22,7 @@
__DATA__
graphemes
+hoc
merchantability
quotelike
postderef