-
-
10 Feb 2021 19:11:37 UTC
- Distribution: XML-Loy
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (64 / 1 / 1)
- Kwalitee
Bus factor: 1- 88.91% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (53.85KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- List::Util
- Mojolicious
- Scalar::Util
- Socket
- Test::More
- Test::Warn
- Time::Local
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
XML::Loy::Atom::Threading - Threading Extension for Atom
SYNOPSIS
use XML::Loy::Atom; my $entry = XML::Loy::Atom->new('entry'); # Add threading extension $entry->extension(-Atom::Threading); # Add Atom author and id $entry->author(name => 'Zoidberg'); $entry->id('http://sojolicious.example/blog/2'); # Add threading information $entry->in_reply_to('urn:entry:1' => { href => 'http://sojolicious.example/blog/1' }); # Add replies information $entry->replies('http://sojolicious.example/blog/1/replies' => { count => 7, updated => time }); # Get threading information print $entry->in_reply_to->[0]->attr('href'); # Pretty print print $entry->to_pretty_xml; # <?xml version="1.0" encoding="UTF-8" standalone="yes"?> # <entry xml:id="http://sojolicious.example/blog/2" # xmlns="http://www.w3.org/2005/Atom" # xmlns:thr="http://purl.org/syndication/thread/1.0"> # <author> # <name>Zoidberg</name> # </author> # <id>http://sojolicious.example/blog/2</id> # <link href="http://sojolicious.example/blog/1" # rel="related" /> # <thr:in-reply-to href="http://sojolicious.example/blog/1" # ref="urn:entry:1" /> # <link href="http://sojolicious.example/blog/1/replies" # rel="replies" # thr:count="7" # thr:updated="2013-03-10T09:55:13Z" # type="application/atom+xml" /> # </entry>
DESCRIPTION
XML::Loy::Atom::Threading is an extension to XML::Loy::Atom and provides additional functionality for the work with Threading.
METHODS
XML::Loy::Atom::Threading inherits all methods from XML::Loy and implements the following new ones.
in_reply_to
$entry->in_reply_to('urn:entry:1' => { href => 'http://sojolicious.example/blog/1.html', type => 'application/xhtml+xml' }); print $entry->in_reply_to->attr('href');
Adds an
in-reply-to
element to the Atom object or returns it. Accepts for adding a universally unique ID for the entry to be referred to, and a hash reference containing attributes likehref
,type
andsource
. Will automatically introduce arelated
link, if ahref
parameter is given. Returns the newly added node.On retrieval, returns the first
in-reply-to
element.replies
$entry->replies('http://sojolicious.example/entry/1/replies' => { count => 5, updated => '2011-08-30T16:16:40Z' }); print $entry->replies->attr('thr:count');
Adds a
link
element with a relation ofreplies
to the atom object or returns it. Accepts the reference URL for replies and optional parameters likecount
andupdate
of replies.The update parameter accepts all valid parameters of XML::Loy::Date::RFC3339::new.
On retrieval returns the first
replies
node.This update attribute is experimental and may return another object with a different API!
total
$entry->total(5); print $entry->total;
Sets the
total
number of responses to the atom object or returns it.DEPENDENCIES
AVAILABILITY
https://github.com/Akron/XML-Loy
COPYRIGHT AND LICENSE
Copyright (C) 2011-2021, Nils Diewald.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl.
Module Install Instructions
To install XML::Loy, copy and paste the appropriate command in to your terminal.
cpanm XML::Loy
perl -MCPAN -e shell install XML::Loy
For more information on module installation, please visit the detailed CPAN module installation guide.