COMPATIBILITY ISSUES

XML::Atom::Service has changed the default namespace since v0.15.0. The new namespaces are 'http://www.w3.org/2005/Atom' and 'http://www.w3.org/2007/app'.

See \s-1NAMESPACES\s0 in details.

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;

DESCRIPTION

The Atom Publishing Protocol (Atompub) is a protocol for publishing and editing Web resources described at http://www.ietf.org/internet-drafts/draft-ietf-atompub-protocol-17.txt <http://www.ietf.org/internet-drafts/draft-ietf-atompub-protocol-17.txt>.

XML::Atom::Service is an Service Document implementation. In the Atom Publishing Protocol, a client needs to first discover the capabilities and locations of Collections. The Service Document is designed to support this discovery process. The document describes the location and capabilities of Collections.

The Atom Publishing Protocol introduces some new \s-1XML\s0 elements, such as app:edited and app:draft, which are imported into XML::Atom. See XML::Atom::Atompub in detail.

This module was tested in InteropTokyo2007 <http://intertwingly.net/wiki/pie/July2007InteropTokyo>, and interoperated with other implementations.

METHODS

Creates a new Service Document object, and if $stream is supplied, fills it with the data specified by $stream.

Automatically handles autodiscovery if $stream is a \s-1URI\s0 (see below).

Returns the new XML::Atom::Service object. On failure, returns \*(C`undef\*(C'.

$stream can be any one of the following:

  • Reference to a scalar This is treated as the \s-1XML\s0 body of the Service Document.

  • Scalar This is treated as the name of a file containing the Service Document \s-1XML\s0.

  • Filehandle This is treated as an open filehandle from which the Service Document \s-1XML\s0 can be read.

  • \s-1URI\s0 object This is treated as a \s-1URI\s0, and the Service Document \s-1XML\s0 will be retrieved from the \s-1URI\s0. If called in scalar context, returns an XML::Atom::Workspace object corresponding to the first \*(L"app:workspace\*(R" element found in the Service Document.

If called in list context, returns a list of XML::Atom::Workspace objects corresponding to all of the app:workspace elements found in the Service Document. 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);

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'. In order to use old ones, you can set them by setting global variables like:

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#';

RELATED TO XML::Atom::Service…

XML::Atom Atompub Catalyst::Controller::Atompub

AUTHOR

Takeru \s-1INOUE\s0, <takeru.inoue _ gmail.com>

LICENCE AND COPYRIGHT

Copyright (c) 2007, Takeru \s-1INOUE\s0 \*(C`<takeru.inoue _ gmail.com>\*(C'. 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

\s-1BECAUSE\s0 \s-1THIS\s0 \s-1SOFTWARE\s0 \s-1IS\s0 \s-1LICENSED\s0 \s-1FREE\s0 \s-1OF\s0 \s-1CHARGE\s0, \s-1THERE\s0 \s-1IS\s0 \s-1NO\s0 \s-1WARRANTY\s0 \s-1FOR\s0 \s-1THE\s0 \s-1SOFTWARE\s0, \s-1TO\s0 \s-1THE\s0 \s-1EXTENT\s0 \s-1PERMITTED\s0 \s-1BY\s0 \s-1APPLICABLE\s0 \s-1LAW\s0. \s-1EXCEPT\s0 \s-1WHEN\s0 \s-1OTHERWISE\s0 \s-1STATED\s0 \s-1IN\s0 \s-1WRITING\s0 \s-1THE\s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