X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FPurePerl.pm;h=a6f1be43903a6e61c5731429f61185824da05127;hb=0aad026606f2d1d5d27cfb8824dd182f790fa9e2;hp=a999394bb50ec0101ba748632bfceba6152810b2;hpb=047d7af00ab8b37c6369c032211bfe492fe6cd05;p=gitmo%2FMouse.git diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index a999394..a6f1be4 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -337,7 +337,23 @@ sub compile_type_constraint{ return; } +package + Mouse::Object; + + +sub BUILDARGS { + my $class = shift; + if (scalar @_ == 1) { + (ref($_[0]) eq 'HASH') + || $class->meta->throw_error("Single parameters to new() must be a HASH ref"); + + return {%{$_[0]}}; + } + else { + return {@_}; + } +} 1; __END__