On Mon Jun 17 06:38:19 2013, david@cantrell.org.uk wrote: > UNIVERSAL::can's behaviour has changed between perl 5.16.3 and perl > 5.18.0 in how it treats classes that have never been seen before. > This code: > > #!/bin/sh > perl -E 'say ">".UNIVERSAL::can("Foo", "can")' > perl -E 'say ">".Foo->can("can")' > perl -E 'package Foo;package main;say ">".UNIVERSAL::can("Foo", "can")' > perl -E 'package Foo;package main;say ">".Foo->can("can")' > > does the following with perl 5.16.3: > > > > > > >CODE(0x19e0e58) > >CODE(0xa60e58) > > and this with 5.18.0: > > >CODE(0x248b090) > >CODE(0x2135090) > >CODE(0x1cd5090) > >CODE(0x145d090) > > As you can see, UNIVERSAL::can("Foo", "can") and Foo->can("can") only > return a sub-ref in 5.16.3 if the Foo package has already been seen. Not exactly. It was not consistent: $ perl -E'package Foo::Bar; say Foo->can("can")' CODE(0x1f4a220) > This change broke Params::Validate::Dependencies and no doubt breaks > other stuff too. I’m not so surprised it broke things, but it was never self-consistent anyway. > Also it appears to be undocumented, including in > perldelta. It’s this entry: =item * C<< $class->can >>, C<< $class->isa >>, and C<< $class->DOES >> now return correct results, regardless of whether that package referred to by C<$class> exists [perl #47113]. It should probably have gone under Incompatible Changes. See https://rt.perl.org/rt3/Ticket/Display.html?id=47113 for the discussion. I don’t think there is much we can do about it at this stage. -- Father Chrysostomos --- via perlbug: queue: perl5 status: new https://rt.perl.org:443/rt3/Ticket/Display.html?id=118513Thread Previous