Skip Menu |

This queue is for tickets about the HTML-Tree CPAN distribution.

Report information
The Basics
Id: 58880
Status: resolved
Priority: 0/
Queue: HTML-Tree

People
Owner: Jeff.Fearn [...] gmail.com
Requestors: sprout [...] cpan.org
Cc:
AdminCc:

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



Subject: constants for traverse are no longer parsed as such
Date: Sun, 27 Jun 2010 14:16:58 -0700
To: bug-HTML-Tree [...] rt.cpan.org
From: Father Chrysostomos <sprout [...] cpan.org>
I think you have inadvertently removed the () prototypes from the constants used to control the traverse method. This changes the way they are parsed. I doubt this will affect any code, though. Just something to take into account....
Subject: Re: [rt.cpan.org #58880] constants for traverse are no longer parsed as such
Date: Mon, 2 Aug 2010 11:59:48 +1000
To: bug-HTML-Tree [...] rt.cpan.org
From: Jeff Fearn <jefffearn [...] gmail.com>
Are you talking about removing the parentheses from the ABORT OK PRUNE PRUNE_SOFTLY PRUNE_UP subs? If so, that was deliberate as it generated perl critic warnings for bad form. If not, please specify the constants you mean. Cheers Jeff. P.S. Sorry for the lag in replying, I've been recovering from an operation. On Mon, Jun 28, 2010 at 7:17 AM, Father Chrysostomos via RT <bug-HTML-Tree@rt.cpan.org> wrote: Show quoted text
> Sun Jun 27 17:17:11 2010: Request 58880 was acted upon. > Transaction: Ticket created by sprout@cpan.org >       Queue: HTML-Tree >     Subject: constants for traverse are no longer parsed as such >   Broken in: (no value) >    Severity: (no value) >       Owner: Nobody >  Requestors: sprout@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58880 > > > > I think you have inadvertently removed the () prototypes from the constants used to control the traverse method. This changes the way they are parsed. I doubt this will affect any code, though. Just something to take into account.... > > >
Subject: Re: [rt.cpan.org #58880] constants for traverse are no longer parsed as such
Date: Sun, 1 Aug 2010 20:18:55 -0700
To: bug-HTML-Tree [...] rt.cpan.org
From: Father Chrysostomos <sprout [...] cpan.org>
On Aug 1, 2010, at 6:59 PM, Jeff Fearn via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=58880 > > > Are you talking about removing the parentheses from the ABORT OK PRUNE > PRUNE_SOFTLY PRUNE_UP subs? > > If so, that was deliberate as it generated perl critic warnings for bad form. > > If not, please specify the constants you mean.
I do mean those constants. I suspect the warning was added to perlcritic because some beginners misuse them and put them on all their subroutines (and then wonder why they get syntax errors). The sole purpose for empty parentheses after a sub name is to make it parse as a 0-ary (nihilary?) function. I.e., ABORT+1 should parse as ABORT()+1, not ABORT(+1). The parentheses also tell perl that it can be inlined. Deparse is really useful for demonstrating this: $ perl -MO=Deparse,-p -e 'sub ABORT {7} print ABORT+8' sub ABORT { 7; } print(ABORT(8)); $ perl -MO=Deparse,-p -e 'sub ABORT() {7} print ABORT+8' sub ABORT () { 7 } print(15); -e syntax OK With the parentheses, it not only makes it parse as a term. It even resolves the constant at compile-time, making the code run faster. Show quoted text
> > Cheers Jeff. > > P.S. Sorry for the lag in replying, I've been recovering from an operation. > > On Mon, Jun 28, 2010 at 7:17 AM, Father Chrysostomos via RT > <bug-HTML-Tree@rt.cpan.org> wrote:
>> Sun Jun 27 17:17:11 2010: Request 58880 was acted upon. >> Transaction: Ticket created by sprout@cpan.org >> Queue: HTML-Tree >> Subject: constants for traverse are no longer parsed as such >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: sprout@cpan.org >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58880 > >> >> >> I think you have inadvertently removed the () prototypes from the constants used to control the traverse method. This changes the way they are parsed. I doubt this will affect any code, though. Just something to take into account.... >> >> >>
>
Subject: Re: [rt.cpan.org #58880] constants for traverse are no longer parsed as such
Date: Mon, 2 Aug 2010 14:12:47 +1000
To: bug-HTML-Tree [...] rt.cpan.org
From: Jeff Fearn <jefffearn [...] gmail.com>
This is very interesting! I'm going to add the parenthesis back in and add your reply as a comment ... as well as telling critic to ignore this section. Thanks for this information :) Cheers, Jeff.
re-added parentheses, added comment explaining what they are there for, told critic to ignore them. Updated pushed to git repo, this will be in the next developer release.
Subject: 4.0 released
Hi HTML::Tree ve4rsion 4.0 has been released which includes a fix for this issue. Cheers, Jeff.