Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Comment on

( #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:

use Module 1.23;

... 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

$ perl -e'use Carp 100 ()' Carp version 100 required--this is only version 1.26 at -e line 1. BEGIN failed--compilation aborted at -e line 1. $ perl -e'use Carp () => 100' Carp version 100 required--this is only version 1.26 at /home/tai/perl +5/perlbrew/perls/perl-5.16.2/lib/5.16.2/Exporter/ line 120. BEGIN failed--compilation aborted at -e line 1.

In your original example, this line:

use Readonly my $unprintable => 0x15;

... is run as:

use Readonly undef => 0x15;

... 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
in thread Perl::Critic error "Readonly version 21 required" by 7stud

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (7)
    As of 2018-06-17 23:14 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (107 votes). Check out past polls.