[Catalyst] Simple question about "use Catalyst"

Gianni Ceccarelli dakkar at thenautilus.net
Mon Oct 19 13:50:46 GMT 2015


On Mon, 19 Oct 2015 14:21:15 +0100
"Andrew" <catalystgroup at unitedgames.co.uk> wrote:
> What was the significance of 5.80 being written there? 

It's a general feature of perl, not specific to Catalyst.

As your most probably already know, when you say::

  use Some::Module qw(some thing);

it behaves as if you had written::

  BEGIN {
    require Some::Module;
    if (Some::Module->can('import')) {
      Some::Module->import(qw(some thing));
    }
  }

When you write::

  use Some::Module 1.3;

it behaves something like::

  BEGIN {
    require Some::Module;
    Some::Module->VERSION(1.3);
  }
  
The ``UNIVERSAL::VERSION`` method throws an exception if (in this
case) the ``$Some::Module::VERSION`` variable has a value less than
what was passed (``1.3``). So you're essentially saying "use this
module, at least this version, or die".

-- 
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88

Mal: "You got all kinds of learning, and you make me look a fool
without even trying, and yet here I am with a gun to your head. That's
cause I got people with me, people who trust each other, and do for
each other, and ain't always looking for an advantage."

Saffron: "Promise me you're going to kill me soon."
				--Episode #6, "Our Mrs Reynolds"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20151019/682bf134/attachment.pgp>


More information about the Catalyst mailing list