From: Lukas Mai Date: Sun, 9 Jun 2013 01:58:39 +0000 (+0200) Subject: simplify dual Moo/Moose logic a bit X-Git-Tag: v1.0103~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47ba782a13ecd4060c36205fde63412ec2b2f601;p=p5sagit%2FFunction-Parameters.git simplify dual Moo/Moose logic a bit --- diff --git a/lib/Function/Parameters/Info.pm b/lib/Function/Parameters/Info.pm index b18814c..382f7e3 100644 --- a/lib/Function/Parameters/Info.pm +++ b/lib/Function/Parameters/Info.pm @@ -4,18 +4,16 @@ use v5.14.0; use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; # If Moo isn't loaded yet but Moose is, avoid pulling in Moo and fall back to Moose -my ($Moo, $meta_make_immutable); +my $Moo; BEGIN { if ($INC{'Moose.pm'} && !$INC{'Moo.pm'}) { $Moo = 'Moose'; - $meta_make_immutable = sub { $_[0]->meta->make_immutable }; } else { require Moo; $Moo = 'Moo'; - $meta_make_immutable = sub {}; } $Moo->import; } @@ -31,7 +29,7 @@ BEGIN { has $_ => (is => 'ro') for qw(name type); - __PACKAGE__->$meta_make_immutable; + __PACKAGE__->meta->make_immutable; } my @pn_ro = glob '{positional,named}_{required,optional}'; @@ -65,7 +63,7 @@ sub args_max { $r } -__PACKAGE__->$meta_make_immutable; +__PACKAGE__->meta->make_immutable; 'ok'