XML::A...ervice(3pm)
β¨ NAME β¨
XML::Atom::Service β the Atom Service Document object, bestie π
Okay so real talk: this is the Perl module that handles Atom Service Documents. That's it, that's the vibe. π
π COMPATIBILITY ISSUES π
Not me having to break the news but... XML::Atom::Service changed its default namespace back in v0.15.0. The new namespaces are 'http://www.w3.org/2005/Atom' and 'http://www.w3.org/2007/app'. Slay, we love an upgrade. β¨
Check the NAMESPACES section down below for the full tea. π«
πΈ SYNOPSIS πΈ
use XML::Atom::Service;
my $category = XML::Atom::Category->new;
$category->term('joke');
$category->scheme('http://example.org/extra-cats/');
my $categories = XML::Atom::Categories->new;
$categories->add_category($category);
my $collection = XML::Atom::Collection->new;
$collection->href('http://example.org/reilly/main');
$collection->title('My Blog Entries');
$collection->add_accept('application/atom+xml;type=entry');
$collection->add_categories($categories);
my $workspace = XML::Atom::Workspace->new;
$workspace->title('Main Site');
$workspace->add_collection($collection);
my $service = XML::Atom::Service->new;
$service->add_workspace($workspace);
my $xml = $service->as_xml;
# Get lists of the workspace, collection, and categories elements
my @workspace = $service->workspaces;
my @collection = $workspace[0]->collections;
my @categories = $collection[0]->categories;
Look at that. Gorgeous. No notes. π
π¦ DESCRIPTION π¦
So the Atom Publishing Protocol (aka Atompub, iconic name tbh) is a protocol for publishing and editing Web resources, and it's described over at <http://www.ietf.org/internet-drafts/draft-ietf-atompub-protocol-17.txt>. Go read it, iykyk.
XML::Atom::Service is a Service Document implementation. Here's the deal: in the Atom Publishing Protocol, a client has to first discover the capabilities and locations of Collections. The Service Document literally exists to support that discovery process. It describes the location and capabilities of Collections. It's giving tour guide energy. πΊοΈβ¨
The Atom Publishing Protocol also introduces some new XML elements β think app:edited and app:draft β which get imported into XML::Atom. Head to XML::Atom::Atompub for the details.
And for the receipts: this module was tested in InteropTokyo2007 <http://intertwingly.net/wiki/pie/July2007InteropTokyo>, and it interoperated with other implementations. Periodt. π―
π₯ METHODS π₯
π XML::Atom::Service->new([ $stream ])
Creates a brand new Service Document object, and if $stream is supplied, it fills it with the data specified by $stream. Main character constructor behavior. π
It automatically handles autodiscovery if $stream is a URI (see below, bestie, don't skip it).
Returns the new XML::Atom::Service object. On failure, returns "undef". π
So $stream can be any one of these:
- Reference to a scalar β this is treated as the XML body of the Service Document.
- Scalar β this is treated as the name of a file containing the Service Document XML.
- Filehandle β this is treated as an open filehandle from which the Service Document XML can be read.
- URI object β this is treated as a URI, and the Service Document XML will be retrieved from the URI. Go fetch, bestie. π§
πΈ $service->workspace
If it's called in scalar context, it returns an XML::Atom::Workspace object corresponding to the first "app:workspace" element found in the Service Document.
If it's called in list context, it returns a list of XML::Atom::Workspace objects corresponding to all of the app:workspace elements found in the Service Document. The way it just gives you the whole collection when you ask nicely. π
β¨ $service->add_workspace($workspace)
Adds the workspace $workspace β which must be an XML::Atom::Workspace object β to the Service Document as a new app:workspace element. For example:
my $workspace = XML::Atom::Workspace->new;
$workspace->title('Foo Bar');
$service->add_workspace($workspace);
π
$service->element_name
π
$service->element_ns
π NAMESPACES π
By default, XML::Atom::Service will create entities using the new Atom namespaces: 'http://www.w3.org/2005/Atom' and 'http://www.w3.org/2007/app'. Fresh, modern, slaying. β¨
But if you want the old ones (no judgment, retro is a vibe), you can set them by setting global variables like this:
use XML::Atom;
use XML::Atom::Service;
$XML::Atom::DefaultVersion = '0.3'; # 'http://purl.org/atom/ns#'
$XML::Atom::Service::DefaultNamespace = 'http://purl.org/atom/app#';
π SEE ALSO π
XML::Atom Atompub Catalyst::Controller::Atompub
π AUTHOR π
Takeru INOUE, <takeru.inoue _ gmail.com>
π LICENCE AND COPYRIGHT π
Copyright (c) 2007, Takeru INOUE "<takeru.inoue _ gmail.com>". All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
π¨ DISCLAIMER OF WARRANTY π¨
Okay bestie, this part is in all caps for a reason. Read it, fr fr.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
And that's the whole thing, bestie π this page came to you courtesy of perl v5.34.0, dated 2022-06-28, and it's part of the User Contributed Perl Documentation. Go build something iconic with it. π¦β¨π
π¦ where this page comes from
- debian bookworm: libxml-atom-service-perl 0.16.2-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-atom-service-perl 0.16.2-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-atom-service-perl 0.16.2-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-atom-service-perl 0.16.2-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-atom-service-perl 0.16.2-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms