Skip Menu |
 

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

Report information
The Basics
Id: 56681
Status: open
Priority: 0/
Queue: Devel-Cycle

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

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



Subject: Unhandled type: REGEXP at ...Devel/Cycle.pm line 107 under Perl 5.12.0.
Download (untitled) / with headers
text/plain 671b
Under Perl 5.12.0: $ perl -MDevel::Cycle -e 'my $foo = qr{bar}smx; find_cycle($foo)' Unhandled type: REGEXP at /usr/local/perl/5.12.0/lib/site_perl/5.12.0/Devel/Cycle.pm line 107. This appears to be because regular expressions have become first-class objects under 5.12, so UNIVERSAL::isa($thingy,'SCALAR'), which was true under 5.10 when $thingy contained a reference to a regexp, is false under 5.12. The attached patches against 1.11 restore the 5.10 behavior under 5.12, by having _get_type() return 'SCALAR' when UNIVERSAL::isa($thingy,'Regexp') is true, and test the handling of regexps. The patches test without reporting any errors under both 5.10.1 and 5.12.0
Subject: Devel-Cycle-pm.patch
--- lib/Devel/Cycle.old 2009-08-24 08:54:45.000000000 -0400 +++ lib/Devel/Cycle.pm 2010-04-16 20:53:30.000000000 -0400 @@ -215,7 +215,7 @@ sub _get_type { my $thingy = shift; return unless ref $thingy; - return 'SCALAR' if UNIVERSAL::isa($thingy,'SCALAR') || UNIVERSAL::isa($thingy,'REF'); + return 'SCALAR' if UNIVERSAL::isa($thingy,'SCALAR') || UNIVERSAL::isa($thingy,'REF') || UNIVERSAL::isa($thingy,'Regexp'); return 'ARRAY' if UNIVERSAL::isa($thingy,'ARRAY'); return 'HASH' if UNIVERSAL::isa($thingy,'HASH'); return 'CODE' if UNIVERSAL::isa($thingy,'CODE');
Subject: Devel-Cycle-t.patch
Download Devel-Cycle-t.patch
text/x-diff 795b
--- t/Devel-Cycle.old 2008-07-08 21:26:35.000000000 -0400 +++ t/Devel-Cycle.t 2010-04-16 20:39:04.000000000 -0400 @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; -use Test::More tests => 12; +use Test::More tests => 13; use Scalar::Util qw(weaken isweak); BEGIN { use_ok('Devel::Cycle') }; @@ -87,6 +87,7 @@ } { + no warnings qw{ once }; *FOOBAR = *FOOBAR if 0; # cease -w my $test2 = { glob => \*FOOBAR }; @@ -101,6 +102,15 @@ is("@warnings", "", "Warn only once"); } +{ + my $test_re = qr{foo}xms; + + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, @_ }; + find_cycle($test_re); + ok( !@warnings, 'No warnings on Regex' ); +} + package foo; use overload q("") => sub{ return 1 }; # show false alarm
RT-Send-CC: modules [...] perl.org, lincoln.stein [...] gmail.com
Download (untitled) / with headers
text/plain 847b
On Fri Apr 16 21:01:50 2010, WYANT wrote: Show quoted text
> Under Perl 5.12.0: > > $ perl -MDevel::Cycle -e 'my $foo = qr{bar}smx; find_cycle($foo)' > Unhandled type: REGEXP at > /usr/local/perl/5.12.0/lib/site_perl/5.12.0/Devel/Cycle.pm line 107. > > This appears to be because regular expressions have become first-class > objects under 5.12, so UNIVERSAL::isa($thingy,'SCALAR'), which was true > under 5.10 when $thingy contained a reference to a regexp, is false > under 5.12. > > The attached patches against 1.11 restore the 5.10 behavior under 5.12, > by having _get_type() return 'SCALAR' when > UNIVERSAL::isa($thingy,'Regexp') is true, and test the handling of > regexps. The patches test without reporting any errors under both 5.10.1 > and 5.12.0
It has been almost 9 months since this bug was filed. Any chance of another release of Devel::Cycle?
RT-Send-CC: modules [...] perl.org, lincoln.stein [...] gmail.com
I have similar issues with "Unhandled type: GLOB".
Download (untitled) / with headers
text/plain 110b
This family of bugs will be fixed over the next few days after I transition the source code from CVS to git.
RT-Send-CC: modules [...] perl.org, lincoln.stein [...] gmail.com
Download (untitled) / with headers
text/plain 642b
On Fri Apr 16 18:01:50 2010, WYANT wrote: Show quoted text
> This appears to be because regular expressions have become first-class > objects under 5.12, so UNIVERSAL::isa($thingy,'SCALAR'), which was true > under 5.10 when $thingy contained a reference to a regexp, is false > under 5.12.
It is not valid to use UNIVERSAL::isa in this way: 1. isa is only a (object or class) method, not a function - it must have an invocant 2. isa should only properly be used for class names or blessed objects, not for base types -- to check the base type of a reference, use Scalar::Util::reftype. Is the repository in git yet? If so, I can provide patches. thank you!
Download (untitled) / with headers
text/plain 214b
On Wed Oct 24 13:19:40 2012, LDS wrote: Show quoted text
> This family of bugs will be fixed over the next few days after I > transition the source code from CVS to git.
I'd love to see this fixed, and I'll even be happy to help.


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.