Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPI::Dumper fails with strict hashpairs (cperl 5.27) #201

Closed
rurban opened this issue May 27, 2017 · 1 comment
Closed

PPI::Dumper fails with strict hashpairs (cperl 5.27) #201

rurban opened this issue May 27, 2017 · 1 comment
Labels

Comments

@rurban
Copy link
Contributor

rurban commented May 27, 2017

cperl 5.27 introduced a new strict mode hashpairs: http://perl11.org/blog/strict-hashpairs.html

PPI/Dumper.pm:126 fails at my %options = map { lc $_ } @_;
It is processing pairs as single elements.

The fix is e.g. to use

--- ./lib/PPI/Dumper.pm~        2017-05-14 16:49:54.000000000 +0200
+++ ./lib/PPI/Dumper.pm 2017-05-27 08:03:29.000000000 +0200
@@ -123,7 +123,8 @@
                }, $class;

        # Handle the options
-       my %options = map { lc $_ } @_;
+       my @options = map { lc $_ } @_; # strict hashpairs
+       my %options = @options;
        foreach ( keys %{$self->{display}} ) {
                if ( exists $options{$_} ) {
                        if ( $_ eq 'indent' ) {

Furthermore, this function is never executed in the testsuite. It only fails in the PPIx modules tests. Breaking Perl::Critic most prominently.

@wchristian
Copy link
Member

The change is rather small, and i'll want to refactor that function anyhow, so adding a quick fix to unblock you is fine. I added a link to this issue in the comment in the commit, and released it to CPAN as PPI-1.228.tar.gz :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants