in reply to Question about UNIVERSAL::can

UNIVERSAL::can() is not designed for checking if a class is loaded. This bug report may shed some light on the matter.

If you just need to check if a module has been loaded, then check %INC (see perlvar). If you care about the subtle difference between modules and packages, try is_class_loaded from Class::Load.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Replies are listed 'Best First'.
Re^2: Question about UNIVERSAL::can
by schetchik (Beadle) on May 28, 2013 at 08:18 UTC

    Thank you for responce.

    It's not a bug, that implies from your link on bug report. But there are nothing about UNIVERSAL's methods call on unloaded modules in the perl documentation

    Does anybody know how to change it? Who is responsible for that part of documentation and for that part of perl? :)

    Thank you

      I'm not sure the UNIVERSAL documentation is the right place. Maybe perlootut?

      p5p is responsible for all the documentation that comes with Perl. See perlhack and perlrepository for information about contributing to Perl.

      package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name