Skip Menu |
 

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

Report information
The Basics
Id: 81394
Status: open
Priority: 0/
Queue: Devel-Declare

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

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



Subject: weird errors with unicode names
Download (untitled) / with headers
text/plain 402b
$ cat unicode1 #!perl use utf8; use Method::Signatures; func foo($neé) {} __END__ $ perl unicode1 Can't call method "prune" on an undefined value at /home/mauke/usr/lib/perl5/site_perl/5.16.2/Method/Signatures/Parser.pm line 19. $ cat unicode2 #!perl use utf8; use Method::Signatures; func naïve() {} naïve(); __END__ $ perl unicode2 Undefined subroutine &main::naïve called at unicode2 line 6.
Subject: Re: [rt.cpan.org #81370] weird errors with unicode names
Date: Fri, 23 Nov 2012 15:04:54 -0800
To: bug-Method-Signatures [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Download (untitled) / with headers
text/plain 2.1k
Thanks for all the reports! rt.cpan.org is a correct place to report bugs, and there's no need to move these, but it is easier for us to work with you if they are reported via Github. In the future, consider using this link to report instead. https://github.com/schwern/Method-Signatures/issues On 2012.11.23 1:21 AM, Lukas Mai via RT wrote: Show quoted text
> $ cat unicode1 > #!perl > use utf8; > use Method::Signatures; > > func foo($neé) {} > __END__ > $ perl unicode1 > Can't call method "prune" on an undefined value at > /home/mauke/usr/lib/perl5/site_perl/5.16.2/Method/Signatures/Parser.pm > line 19.
This one I can replicate. That error is due to PPI failing to parse the argument list. The error from PPI is Fatal error... regex failed to match in 'é ' when expected at /Users/schwern/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/PPI/Token/Word.pm line 416. I suspect what's happening is PPI is looking at $neé, sees $ne as a scalar and then doesn't know what the following é is. However, PPI seems to be able to figure out a utf8 encoded string just fine. $ perl -wle 'use PPI; { use utf8; $proto = q[$neé]; } my $ppi = PPI::Document->new(\$proto); print $ppi; print PPI::Document->errstr' $ne? It's only when it sees a UTF8 which hasn't been declared UTF8 that it messes up. $ perl -wle 'use PPI; { $proto = q[$neé]; } my $ppi = PPI::Document->new(\$proto); print $ppi; print PPI::Document->errstr' Use of uninitialized value $ppi in print at -e line 1. Fatal error... regex failed to match in 'é ' when expected at /Users/schwern/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/PPI/Token/Word.pm line 416. Looking at the prototype with Devel::Peek confirms, there's no UTF8 flag on the prototype. We're losing it somewhere along the way. That somewhere appears to be inside Devel::Declare::get_linestr(). Source lines are coming out of it without the UTF8 flag. We'll have to put together a simple example using Devel::Declare and report it upstream. Show quoted text
> $ cat unicode2 > #!perl > use utf8; > use Method::Signatures; > > func naïve() {} > naïve(); > __END__ > $ perl unicode2 > Undefined subroutine &main::naïve called at unicode2 line 6.
This one I can't replicate.
Subject: Devel::Declare::get_linestr loses the UTF8 flag.
Download (untitled) / with headers
text/plain 395b
Devel::Declare::get_linestr() loses the UTF8 flag on source strings. The attached tarball demonstrates. This is important for correctly parsing Perl code. It depends on knowing if the source is utf8 or not as demonstrated in this Method::Signatures bug. https://rt.cpan.org/Ticket/Display.html?id=81370 This is perl 5, version 14, subversion 1 (v5.14.1) built for darwin-thread-multi-2level
Subject: dd_bug.tar.gz
Download dd_bug.tar.gz
application/x-gzip 557b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 204b
Reported upstream as https://rt.cpan.org/Ticket/Display.html?id=81394. Its maybe possible we could work around it, but its a general Devel::Declare problem so I'm inclined to let them have a crack at it.
Whoops, I didn't mean to merge these. Oh well.


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.