JSON-Hyper
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/JSON/Hyper/Link.pm view on Meta::CPAN
package JSON::Hyper::Link;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.011';
use strict qw( subs vars );
sub new
{
my ($class, $self) = @_;
$self = +{ href => $self } unless ref $self;
bless $self => $class;
}
my @attr = qw/
href
rel
targetSchema
method
enctype
schema
properties
/;
foreach my $attr (@attr)
{
*$attr = sub {
shift->{$attr};
};
}
*target_schema = \&targetSchema;
1;
__END__
=head1 NAME
JSON::Hyper::Link - represents a link found in a JSON document
=head1 DESCRIPTION
This is a tiny object representng a hyperlink found in a JSON document.
You totally have my permission to treat it as a hashref if you want.
Encapsulation, ensmapulation!
=head2 Constructor
Generally speaking you don't want to construct these. They're constructed
by JSON::Hyper's C<find_links> method and I can't think of any conceivable
reason why you'd want to construct one yourself. Nevertheless...
=over
=item C<< new(\%attrs) >>
=item C<< new($uri) >>
Constructor takes a hashref of attributes, or a single URI as a string.
=back
=head2 Attributes
These attributes are hash keys for the constructor, and also exist as
methods that can be called on the object to retrieve the value.
=over
=item C<href>
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.391 second using v1.00-cache-2.02-grep-82fe00e-cpan-3b7f77b76a6c )