The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::PMP::CollectionDoc - Collection.doc+JSON object for Net::PMP::Client

SYNOPSIS

 my $doc = $pmp_client->get_doc();
 printf("API version: %s\n", $doc->version);
 my $query_links = $doc->get_links('query');

DESCRIPTION

Net::PMP::CollectionDoc represents the PMP API media type https://github.com/publicmediaplatform/pmpdocs/wiki/Collection.doc-JSON-Media-Type.

METHODS

href

The unique identifier. See http://cdoc.io/spec.html#guid-vs-href.

items

Returns arrayref of child items. These are returned as a convenience from the server and are not a native part of the CollectionDoc.

get_links( type )

Returns Net::PMP::CollectionDoc::Links object for type, which may be one of (for example):

creator
edit
query
permission

Returns hashref of link data.

attributes

Returns hashref of attribute data.

version

Returns API version string.

get_items

Returns Net::PMP::CollectionDoc::Items object, unlike the items accessor method, which returns the raw arrayref.

has_items

Returns total number of items this CollectionDoc refers to. NOTE this is not the current result set, but the server-side total. I.e., paging is ignored.

query(urn)

Returns Net::PMP::CollectionDoc::Link object matching urn, or undef if no match is found.

get_title

Returns title attribute value.

get_profile

Returns first profile link href value.

get_uri

Returns the href string from the navigation link representing this CollectionDoc.

get_publish_uri([edit_link])

Returns the href string from the edit link representing this CollectionDoc.

edit_link may be passed explicitly, which is usually necessary for saving a doc the first time.

get_self_uri

Returns canonical URI for Doc per 'self' link.

set_uri(uri)

Sets the href string for the navigation link representing this CollectionDoc.

get_guid

Returns the guid attribute.

create_guid([use_remote])

Returns a v4-compliant UUID per PMP spec.

NOTE the use_remote flag is currently ignored.

set_guid([<Iguid>])

Sets the guid attribute to guid. If guid is omitted, the return value of create_guid() is used.

as_hash

Returns the CollectionDoc as a hashref. as_json() calls this method internally.

Returns minimal hashref describing CollectionDoc, suitable for links item attribute. This method is called internally by as_hash(); it automatically recurses for any descendent items.

as_json

Returns the CollectionDoc as a JSON-encoded string suitable for saving.

add_item( child )

Shortcut for:

  push @{ $doc->links->{item} }, $child->as_link_hash;

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-pmp at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-PMP. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::PMP::CollectionDoc

You can also look for information at:

ACKNOWLEDGEMENTS

American Public Media and the Public Media Platform sponsored the development of this module.

LICENSE AND COPYRIGHT

Copyright 2013 American Public Media Group

See the LICENSE file that accompanies this module.