X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FObject.pm;h=b73ed3d16a407ce405d70b5df9a91dd3ee918940;hb=f55dd47ffcd014c9d917351b5d2e57ab9210ca27;hp=36f4bf3cf693fdd5d151bd8311ba9985a4f9246d;hpb=db236a63c00371129c2254251aaa1408f044cd89;p=gitmo%2FMoose.git diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 36f4bf3..b73ed3d 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -4,6 +4,7 @@ package Moose::Object; use strict; use warnings; +use Carp (); use Devel::GlobalDestruction (); use MRO::Compat (); use Scalar::Util (); @@ -12,7 +13,7 @@ use Try::Tiny (); use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class'; use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; -our $VERSION = '1.10'; +our $VERSION = '1.19'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -35,6 +36,12 @@ sub BUILDARGS { } return { %{ $_[0] } }; } + elsif ( @_ % 2 ) { + Carp::carp( + "The new() method for $class expects a hash reference or a key/value list." + . " You passed an odd number of arguments" ); + return { @_, undef }; + } else { return {@_}; }