X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FPurePerl.pm;h=a6f1be43903a6e61c5731429f61185824da05127;hb=0aad026606f2d1d5d27cfb8824dd182f790fa9e2;hp=9b67e302906faf63424dd0194b80732da3d1c589;hpb=f790c46b83718b0665e24380b0df0c387925ea27;p=gitmo%2FMouse.git diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index 9b67e30..a6f1be4 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -1,5 +1,7 @@ package Mouse::PurePerl; +require Mouse::Util; + package Mouse::Util; @@ -166,7 +168,7 @@ package sub name { $_[0]->{package} } sub _method_map { $_[0]->{methods} } -sub _attribute_map{ $_[0]->{attribute_map} } +sub _attribute_map{ $_[0]->{attributes} } sub namespace{ my $name = $_[0]->{package}; @@ -209,6 +211,12 @@ sub roles { $_[0]->{roles} } sub linearized_isa { @{ get_linear_isa($_[0]->{package}) } } +sub get_all_attributes { + my($self) = @_; + my %attrs = map { %{ $self->initialize($_)->{attributes} } } reverse $self->linearized_isa; + return values %attrs; +} + package Mouse::Meta::Role; @@ -329,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__ @@ -340,7 +364,7 @@ Mouse::PurePerl - A Mouse guts in pure Perl =head1 VERSION -This document describes Mouse version 0.40_03 +This document describes Mouse version 0.40_05 =head1 SEE ALSO