X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FPurePerl.pm;h=a6f1be43903a6e61c5731429f61185824da05127;hp=2a5c05af4f797dedfb665d206377d294d2b1bb76;hb=aa2d2e2c0621cdcb8b2ec7cf49beb3a9de11803c;hpb=a52cca0441a1196bbf294aebcf80fbc8f8f3ea8e diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index 2a5c05a..a6f1be4 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -168,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}; @@ -211,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; @@ -331,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__ @@ -342,7 +364,7 @@ Mouse::PurePerl - A Mouse guts in pure Perl =head1 VERSION -This document describes Mouse version 0.40_04 +This document describes Mouse version 0.40_05 =head1 SEE ALSO