Skip Menu |

This queue is for tickets about the Keyword-Declare CPAN distribution.

Report information
The Basics
Id: 123817
Status: resolved
Priority: 0/
Queue: Keyword-Declare

People
Owner: Nobody in particular
Requestors: ovid [...] allaroundtheworld.fr
Cc:
AdminCc:

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



Subject: Keyword::Declare fails with postfix dereferencing
Date: Sun, 3 Dec 2017 23:02:01 +0100
To: bug-Keyword-Declare [...] rt.cpan.org
From: Curtis Poe <ovid [...] allaroundtheworld.fr>
Hi Damian, Keyword::Declare is a lovely module, but I've found an edge case that's troublesome. #!/usr/bin/env perl use 5.024; use Keyword::Declare; keyword DEVELOPMENT( Block $block) { if ( $ENV{PERL_KEYWORD_DEVELOPMENT} ) { return $block; } return "# Code Omitted"; } my $aref = [ 1, 2, 3 ]; DEVELOPMENT { my @example = map { $_ => $_ } $aref->@*; print join '-' => @example; } That code fails with: $ PERL_KEYWORD_DEVELOPMENT=1 perl declare.pl Invalid DEVELOPMENT at declare.pl line 14. Expected: DEVELOPMENT <block> but found: DEVELOPMENT { Compilation failed at declare.pl line 14. If I change the postfix dereferencing to @$aref, it works just fine. Curtis "Ovid" Poe CTO, All Around the World World-class software development and consulting https://allaroundtheworld.fr/
Subject: Re: [rt.cpan.org #123817] Keyword::Declare fails with postfix dereferencing
Date: Wed, 6 Dec 2017 08:23:00 +1100
To: bug-Keyword-Declare [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks, Curtis. The bug was actally in PPR's parsing, not in Keyword::Declare itself. I've just uploaded a new release of PPR that remedies the omission of ->$*, ->@*, and ->%* from the grammar. If you install that new version of PPR, Keyword::Declare should accept your keyword block. Much appreciated! Damian