— |
our $VERSION = '0.001' ;
has '+type' => ( required => 0);
has name => (
is => 'rw' ,
isa => Str,
required => 1,
);
has path => (
is => 'ro' ,
required => 1,
);
around TO_JSON => sub {
my $orig = shift ;
my $self = shift ;
my $meta = $self ->meta;
my %result ;
for my $attr ( $meta ->get_all_attributes) {
my $name = $attr ->name;
next if $name eq 'path' ;
my $value = $attr ->get_value( $self );
my $type = $attr ->type_constraint;
$result { $name } = $value if defined $value ;
}
return \ %result ;
};
__PACKAGE__->meta->make_immutable;
|