From: Matt S Trout Date: Wed, 4 Jul 2007 17:40:54 +0000 (+0000) Subject: fix autobox loading approach X-Git-Tag: 0_06~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ee6bd664e02b8d460803a4c934264ad5f25bdc83;p=gitmo%2FMoose-Autobox.git fix autobox loading approach --- diff --git a/Changes b/Changes index 7ac79b1..4084967 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension Moose::Autobox + * Moose::Autobox + - fixed loading approach so that Moose::Object doesn't end up in isa + 0.04 Thurs. May 31, 2007 * Moose::Autobox::Hash - added method for shallow hash merging @@ -17,7 +20,6 @@ Revision history for Perl extension Moose::Autobox * Moose::Autobox::Scalar/Array/Hash - added &print/&say to SCALAR, ARRAY and HASH - 0.03 Thurs. Aug 17, 2006 * Moose::Autobox diff --git a/lib/Moose/Autobox.pm b/lib/Moose/Autobox.pm index 6ca3141..fc445af 100644 --- a/lib/Moose/Autobox.pm +++ b/lib/Moose/Autobox.pm @@ -30,34 +30,42 @@ sub mixin_additional_role { { package Moose::Autobox::SCALAR; - # NOTE: - # this doesnt make sense, but - # I need to prevent Moose from - # assiging to @ISA - use base 'UNIVERSAL'; - use Moose; - with 'Moose::Autobox::Scalar'; + + use Moose::Autobox::Scalar; + + use metaclass 'Moose::Meta::Class'; + + __PACKAGE__->meta->_apply_all_roles('Moose::Autobox::Scalar'); *does = \&Moose::Object::does; package Moose::Autobox::ARRAY; - use base 'UNIVERSAL'; - use Moose; - with 'Moose::Autobox::Array'; + + use Moose::Autobox::Array; + + use metaclass 'Moose::Meta::Class'; + + __PACKAGE__->meta->_apply_all_roles('Moose::Autobox::Array'); *does = \&Moose::Object::does; package Moose::Autobox::HASH; - use base 'UNIVERSAL'; - use Moose; - with 'Moose::Autobox::Hash'; + + use Moose::Autobox::Hash; + + use metaclass 'Moose::Meta::Class'; + + __PACKAGE__->meta->_apply_all_roles('Moose::Autobox::Hash'); *does = \&Moose::Object::does; package Moose::Autobox::CODE; - use base 'UNIVERSAL'; - use Moose; - with 'Moose::Autobox::Code'; + + use Moose::Autobox::Code; + + use metaclass 'Moose::Meta::Class'; + + __PACKAGE__->meta->_apply_all_roles('Moose::Autobox::Code'); *does = \&Moose::Object::does; diff --git a/t/007_base.t b/t/007_base.t new file mode 100644 index 0000000..2453723 --- /dev/null +++ b/t/007_base.t @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 5; + +use_ok("Moose::Autobox"); + +foreach my $stem (qw(SCALAR ARRAY HASH CODE)) { + my $class = "Moose::Autobox::${stem}"; + ok(!$class->isa('Moose::Object'), "${class} !isa Moose::Object"); +}