Skip Menu |

This queue is for tickets about the MooseX-Method-Signatures CPAN distribution.

Report information
The Basics
Id: 63594
Status: open
Priority: 0/
Queue: MooseX-Method-Signatures

Owner: Nobody in particular
Requestors: j-zbiciak1 [...]

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

Subject: Newline between method and { causes strange behavior
Date: Sat, 4 Dec 2010 13:59:05 -0600
To: bug-MooseX-Method-Signatures [...]
From: Joe Zbiciak <j-zbiciak1 [...]>
Hello, In the attached example, if I put my opening curly brace for a 'method' on the same line as 'method' itself, everything works as expected. If I move the curly brace to the next line, it fails. What ends up happening is that MooseX::Method::Signatures appeares to pick up the signature for the *next* method, not the current method. Also, the last method in the package goes totally missing. The example '' shows the misapplied method signatures. It results in the following output: $ ./ Not busted: one_arg(not busted) Busted: Validation failed for 'Tuple[Tuple[Object,Any,Any],Dict[]]' with value [ [ busted=HASH(0x8f7152c), "busted" ], { } ], Internal Validation Error is: [+] Validation failed for 'Tuple[Object,Any,Any]' with value [ busted{ }, "busted" ] [+] Validation failed for 'Any' with value NULL at /db/perf/lib/perl5/site_perl/5.12.2/MooseX/Method/Signatures/Meta/ line 435 MooseX::Method::Signatures::Meta::Method::validate('MooseX::Method::Signatures::Meta::Method=HASH(0x8f71c34)', 'ARRAY(0x8f71928)') called at /db/perf/lib/perl5/site_perl/5.12.2/MooseX/Method/Signatures/Meta/ line 151 busted::one_arg('busted=HASH(0x8f7152c)', 'busted') called at ./ line 14 The example '' shows how the final method in the module goes AWOL. It outputs the following: $ ./ Not busted: two_args(not, busted) Busted: Can't locate object method "two_args" via package "busted" at ./ line 14. Module version information: Perl 5.12.2 Moose 1.21 MooseX::Method::Signatures 0.36 Devel::Declare 0.006000 This is a fresh installation of Perl, Moose, etc. brought up to date with CPAN as of yesterday (03-Dec-2010). Regards, --Joe Zbiciak -- : Joseph Zbiciak, SMTS : Discovery consists of seeing : : what everybody has seen and : #include <std_disc.h> : thinking what nobody has thought. : Texas Instruments : --Albert Szent-Gyorgyi
application/zip 1k

Message body not shown because it is not plain text.

From: Joe Zbiciak
Download (untitled) / with headers
text/plain 935b
I decided to dig about in the source code. (Shock! Horror!) I think I spotted the error in the logic, but I don't think I'm qualified to fix it. Here's where I think the thinko is: The _parser function sets up its code injector after all of the method arguments and other sugar are parsed. The body of the code injector sits in a "on_scope_end" hook. I'm willing to wager that the reason the code works with the curly brace on the same line as the last thing 'method' parsed is that Perl's parser has already entered the scope of the method's body. The reason it fails when the curly is on the next line is that it hasn't yet entered that scope. So, the code gets injected in the wrong place. I'm no expert in perl internals, but I think this is where the weirdness comes from. It could also explain the rather similar bug 61070--ie. they're really the same bug. I'll leave it to the experts to figure out the correct fix.
From: alain [...]
Download (untitled) / with headers
text/plain 306b
Joe, this is a duplicate of the following bug which has been open for quite a while now, and deemed "critical:" It only happens with perl 5.12.x. The only workaround right now is to simply use braces on the next line, or downgrade perl to 5.10.x.
From: alain [...]
Download (untitled) / with headers
text/plain 228b
On Wed Feb 02 21:13:59 2011, aavakian wrote: Show quoted text
> The only workaround right now is to > simply use braces on the next line, or downgrade perl to 5.10.x.
and of course, I meant for the workaround to use braces on the *same* line.
Subject: Re: [ #63594] Newline between method and { causes strange behavior
Date: Thu, 3 Feb 2011 00:39:45 -0600
To: Alain Avakian via RT <bug-MooseX-Method-Signatures [...]>
From: Joe Zbiciak <j-zbiciak1 [...]>
Download (untitled) / with headers
text/plain 566b
Alain, I wasn't 100% certain I was hitting the same bug, since my symptoms weren't exactly the same. If I knew more about perl internals, I might attempt a fix. For now, I am going to stick with Perl 5.12, move my brace to the same line as method where needed, and apply MooseX::Method::Signatures sparingly in new code. Thanks, --Joe -- : Joseph Zbiciak, SMTS : "I am always doing what I : : cannot do yet, in order to : #include <std_disc.h> : learn how to do it." : Texas Instruments : -- Vincent van Gogh
Download (untitled) / with headers
text/plain 164b
Does this issue still exist? Recent releases to Devel::Declare appear to address similar reported issues (e.g.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to