version 1.0104
[p5sagit/Function-Parameters.git] / lib / Function / Parameters / Info.pm
index 7767b36..ffec607 100644 (file)
@@ -1,23 +1,34 @@
 package Function::Parameters::Info;
 
 use v5.14.0;
-
 use warnings;
 
-use Moo;
-
-our $VERSION = '0.02';
+our $VERSION = '0.04';
+
+# If Moo isn't loaded yet but Moose is, avoid pulling in Moo and fall back to Moose
+my $Moo;
+BEGIN {
+       if ($INC{'Moose.pm'} && !$INC{'Moo.pm'}) {
+               $Moo = 'Moose';
+       } else {
+               require Moo;
+               $Moo = 'Moo';
+       }
+       $Moo->import;
+}
 
 {
        package Function::Parameters::Param;
 
-       use Moo;
+       BEGIN { $Moo->import; }
        use overload
                fallback => 1,
-               '""' => sub { $_[0]->name },
+               '""'     => sub { $_[0]->name },
        ;
 
        has $_ => (is => 'ro') for qw(name type);
+
+       __PACKAGE__->meta->make_immutable;
 }
 
 my @pn_ro = glob '{positional,named}_{required,optional}';
@@ -51,6 +62,8 @@ sub args_max {
        $r
 }
 
+__PACKAGE__->meta->make_immutable;
+
 'ok'
 
 __END__
@@ -157,7 +170,7 @@ Lukas Mai, C<< <l.mai at web.de> >>
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2012 Lukas Mai.
+Copyright 2013 Lukas Mai.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of either: the GNU General Public License as published