From: Stevan Little Date: Mon, 7 Apr 2008 04:09:29 +0000 (+0000) Subject: more tweaks X-Git-Tag: 0.04~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a7bc2f67d5cb1bb9e827167c73fb4370d8aba06;p=gitmo%2FMooseX-MetaDescription.git more tweaks --- diff --git a/lib/MooseX/MetaDescription/Description/Attribute.pm b/lib/MooseX/MetaDescription/Description/Attribute.pm index 36489cd..ebad881 100644 --- a/lib/MooseX/MetaDescription/Description/Attribute.pm +++ b/lib/MooseX/MetaDescription/Description/Attribute.pm @@ -24,7 +24,7 @@ MooseX::MetaDescription::Description::Attribute - A Moosey solution to this prob use MooseX::MetaDescription::Description::Attribute; -=head1 DESCRIPTION +=head1 DESCRIPTIONsv =head1 METHODS diff --git a/lib/MooseX/MetaDescription/Meta/Role/HasDescription.pm b/lib/MooseX/MetaDescription/Meta/Role/HasDescription.pm index cdb56df..2b4b584 100644 --- a/lib/MooseX/MetaDescription/Meta/Role/HasDescription.pm +++ b/lib/MooseX/MetaDescription/Meta/Role/HasDescription.pm @@ -4,12 +4,7 @@ use Moose::Role; our $VERSION = '0.01'; our $AUTHORITY = 'cpan:STEVAN'; -has 'description' => ( - is => 'ro', - isa => 'HashRef', - lazy => 1, - default => sub { +{} }, -); + no Moose::Role; 1; diff --git a/lib/MooseX/MetaDescription/Meta/Role/HasMetaDescription.pm b/lib/MooseX/MetaDescription/Meta/Role/HasMetaDescription.pm index 8ff41d3..a757fa0 100644 --- a/lib/MooseX/MetaDescription/Meta/Role/HasMetaDescription.pm +++ b/lib/MooseX/MetaDescription/Meta/Role/HasMetaDescription.pm @@ -4,7 +4,12 @@ use Moose::Role; our $VERSION = '0.01'; our $AUTHORITY = 'cpan:STEVAN'; -with 'MooseX::MetaDescription::Meta::Role::HasDescription'; +has 'description' => ( + is => 'ro', + isa => 'HashRef', + lazy => 1, + default => sub { +{} }, +); has 'metadescription_classname' => ( is => 'ro', @@ -21,7 +26,7 @@ has 'metadescription' => ( # TODO: handle traits ... $self->metadescription_classname->new( - %{$self->description}, + %{ $self->description }, descriptor => $self, ) }, diff --git a/t/000_load.t b/t/000_load.t index 170dd7b..04cf405 100644 --- a/t/000_load.t +++ b/t/000_load.t @@ -13,7 +13,6 @@ BEGIN { use_ok('MooseX::MetaDescription::Meta::Attribute'); use_ok('MooseX::MetaDescription::Meta::Attribute::Trait'); - use_ok('MooseX::MetaDescription::Meta::Role::HasDescription'); use_ok('MooseX::MetaDescription::Meta::Role::HasMetaDescription'); use_ok('MooseX::MetaDescription::Description'); diff --git a/t/001_basic.t b/t/001_basic.t index df22013..9628291 100644 --- a/t/001_basic.t +++ b/t/001_basic.t @@ -43,12 +43,15 @@ BEGIN { # check the meta-desc my $foo_class = Foo->meta; +isa_ok($foo_class->metadescription, 'MooseX::MetaDescription::Description::Class'); is($foo_class->metadescription->descriptor, $foo_class, '... got the circular ref'); my $bar_attr = Foo->meta->get_attribute('bar'); +isa_ok($bar_attr->metadescription, 'MooseX::MetaDescription::Description::Attribute'); is($bar_attr->metadescription->descriptor, $bar_attr, '... got the circular ref'); my $baz_attr = Foo->meta->get_attribute('baz'); +isa_ok($baz_attr->metadescription, 'MooseX::MetaDescription::Description::Attribute'); is($baz_attr->metadescription->descriptor, $baz_attr, '... got the circular ref'); # check the actual descs