JSORB::Core::Element - A core JSORB element


JSORB documentation Contained in the JSORB distribution.

Index


Code Index:

NAME

Top

JSORB::Core::Element - A core JSORB element

DESCRIPTION

Top

Basically this is a named element that is assumed to have a parent object. Not much else here to see.

BUGS

Top

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.

AUTHOR

Top

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE

Top


JSORB documentation Contained in the JSORB distribution.

package JSORB::Core::Element;
use Moose;
use MooseX::AttributeHelpers;

our $VERSION   = '0.04';
our $AUTHORITY = 'cpan:STEVAN';

has 'name' => (
    is       => 'ro',
    isa      => 'Str',
    required => 1
);

has 'parent' => (
    is        => 'ro',
    writer    => '_set_parent',
    isa       => 'JSORB::Core::Element',
    weak_ref  => 1,
    predicate => 'has_parent',
);

has 'fully_qualified_name' => (
    metaclass => 'Collection::List',
    init_arg  => undef,
    is        => 'ro',
    isa       => 'ArrayRef[Str]',
    lazy      => 1,
    default   => sub {
        my $current = shift;
        my @full_name = ($current->name);
        while ($current->has_parent) {
            $current = $current->parent;
            unshift @full_name => $current->name;
        }
        \@full_name;
    }
);

__PACKAGE__->meta->make_immutable;

no Moose; 1;

__END__