Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 64247
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: wyant [...] cpan.org
Cc:
AdminCc:

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



Subject: bless {} probably contains a hash constructor, not a block
PPI parses 'bless {}' as PPI::Document PPI::Statement [ 1, 1, 1 ] PPI::Token::Word 'bless' PPI::Structure::Block { ... } The bless documentation says that the first argument is a reference. While a block can certainly yield a reference, 'bless {; +{}}' (forcing the outer curlys to be a block, and the inner to be a hash constructor) fails to parse in Perl 5.6.2, 5.8.9, 5.10.1, 5.12.2, and 5.13.8, so I conclude that in any working Perl of semi-recent vintage, 'bless {...}' must contain an anonymous hash, not a block. But I am a little nervous about the conclusion, since I can not find in the docs anything that says unequivocally that the first argument to bless() can not be a block. A patch is in preparation, but I wanted to get the RT ticket filed first, so I could reference it in the commit comment. The related Perl::Critic ticket is https://rt.cpan.org/Ticket/Display.html?id=64132 If you would like to see more support for the proposed change, I can think of three things to do: * Scavenge CPAN, and use B::Concise to try to figure out what Perl is doing; * Submit a wishlist to Perl, asking for clarification; * Read the code. I don't really hold much hope for the last, since generally when I try it my brain just bounces off. But I will certainly attempt to gather any further supporting information you would like to see.
Proposed solution committed as SVN revision 13495.
This appears to be in PPI 1.215. Thank you very much.
Confirmed resolved