The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
It seems Exporter (which Readonly, and many, many, many, many other modules use internally) has a weird feature (in my opinion a misfeature) where it does its own module version number checking. Normally when you write:
... perl will catch the version number, and not treat it as an argument to Module->import, instead passing it to Module->VERSION to act as a version number check. However, it seems Exporter makes an attempt to catch number-like arguments that perl has missed, and do its own version checking with them. Notice the difference between the following two examples; the first one where the version check is done by perl, and the second where it's done by Exporter.pm
In your original example, this line:
... is run as:
... because the variable is undefined. So Exporter's version number check kicks in, even though the 0x15 was clearly never intended as a module version number. Yet another reason to avoid using Exporter and use something sane like Sub::Exporter.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In reply to Re^2: Perl::Critic error "Readonly version 21 required"
by tobyink
|
|