our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
+has 'descriptor' => (
+ is => 'ro',
+ required => 1,
+);
+
no Moose; 1;
__END__
extends 'MooseX::MetaDescription::Description';
-has 'attribute' => (
- is => 'ro',
- does => 'MooseX::MetaDescription::Meta::Attribute::Trait',
- weak_ref => 1,
- required => 1,
+has '+descriptor' => (
+ does => 'MooseX::MetaDescription::Meta::Attribute::Trait',
);
no Moose; 1;
extends 'MooseX::MetaDescription::Description';
-has 'class' => (
- isa => 'MooseX::MetaDescription::Meta::Class',
- is => 'ro',
- weak_ref => 1,
- required => 1,
+has '+descriptor' => (
+ isa => 'MooseX::MetaDescription::Meta::Class',
);
no Moose; 1;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
-has 'description' => (
- is => 'ro',
- isa => 'HashRef',
- lazy => 1,
- default => sub { +{} },
-);
+with 'MooseX::MetaDescription::Meta::Role::HasMetaDescription';
-has 'metadescription' => (
- is => 'ro',
- isa => 'MooseX::MetaDescription::Description',
- lazy => 1,
- default => sub {
- my $self = shift;
-
- # TODO: handle traits ...
-
- MooseX::MetaDescription::Description::Attribute->new(
- %{$self->description},
- attribute => $self,
- )
+has '+metadescription_classname' => (
+ default => sub {
+ 'MooseX::MetaDescription::Description::Attribute'
},
);
our $AUTHORITY = 'cpan:STEVAN';
extends 'Moose::Meta::Class';
+ with 'MooseX::MetaDescription::Meta::Role::HasMetaDescription';
-has 'description' => (
- is => 'ro',
- isa => 'HashRef',
- lazy => 1,
- default => sub { +{} },
-);
-
-has 'metadescription' => (
- is => 'ro',
- isa => 'MooseX::MetaDescription::Description',
- lazy => 1,
+has '+metadescription_classname' => (
default => sub {
- my $self = shift;
-
- # TODO: handle traits ...
-
- MooseX::MetaDescription::Description::Class->new(
- %{$self->description},
- class => $self,
- )
+ 'MooseX::MetaDescription::Description::Class'
},
);
=head1 DESCRIPTION
-=head1 METHODS
+=head1 METHODS
=over 4
=head1 BUGS
-All complex software has bugs lurking in it, and this module is no
+All complex software has bugs lurking in it, and this module is no
exception. If you find a bug please either email me, or add the bug
to cpan-RT.
--- /dev/null
+package MooseX::MetaDescription::Meta::Role::HasDescription;
+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;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::MetaDescription::Meta::Role::HasDescription - A Moosey solution to this problem
+
+=head1 SYNOPSIS
+
+ use MooseX::MetaDescription::Meta::Role::HasDescription;
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<>
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2008 Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
--- /dev/null
+package MooseX::MetaDescription::Meta::Role::HasMetaDescription;
+use Moose::Role;
+
+our $VERSION = '0.01';
+our $AUTHORITY = 'cpan:STEVAN';
+
+with 'MooseX::MetaDescription::Meta::Role::HasDescription';
+
+has 'metadescription_classname' => (
+ is => 'ro',
+ isa => 'Str',
+);
+
+has 'metadescription' => (
+ is => 'ro',
+ isa => 'MooseX::MetaDescription::Description',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+
+ # TODO: handle traits ...
+
+ $self->metadescription_classname->new(
+ %{$self->description},
+ descriptor => $self,
+ )
+ },
+);
+
+no Moose::Role; 1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::MetaDescription::Meta::Role::HasMetaDescription - A Moosey solution to this problem
+
+=head1 SYNOPSIS
+
+ use MooseX::MetaDescription::Meta::Role::HasMetaDescription;
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<>
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2008 Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
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');
use_ok('MooseX::MetaDescription::Description::Class');
use_ok('MooseX::MetaDescription::Description::Attribute');
# check the meta-desc
my $foo_class = Foo->meta;
-is($foo_class->metadescription->class, $foo_class, '... got the circular ref');
+is($foo_class->metadescription->descriptor, $foo_class, '... got the circular ref');
my $bar_attr = Foo->meta->get_attribute('bar');
-is($bar_attr->metadescription->attribute, $bar_attr, '... got the circular ref');
+is($bar_attr->metadescription->descriptor, $bar_attr, '... got the circular ref');
my $baz_attr = Foo->meta->get_attribute('baz');
-is($baz_attr->metadescription->attribute, $baz_attr, '... got the circular ref');
+is($baz_attr->metadescription->descriptor, $baz_attr, '... got the circular ref');
# check the actual descs