.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Atompub::Client 3pm" .TH Atompub::Client 3pm "2012-04-04" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Atompub::Client \- A client for the Atom Publishing Protocol .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Atompub::Client; \& \& my $client = Atompub::Client\->new; \& $client\->username(\*(AqMelody\*(Aq); \& $client\->password(\*(AqNelson\*(Aq); \& #$client\->proxy( $proxy_uri ); \& \& # Get a Service Document \& my $service = $client\->getService($service_uri); \& \& my @workspaces = $service\->workspaces; \& my @collections = $workspaces[0]\->collections; \& \& # CRUD an Entry Resource; assuming that the 0\-th collection supports \& # Entry Resources \& my $collection_uri = $collections[0]\->href; \& \& my $name = \*(AqNew Post\*(Aq; \& \& my $entry = XML::Atom::Entry\->new; \& $entry\->title($name); \& $entry\->content(\*(AqContent of my post.\*(Aq); \& \& my $edit_uri = $client\->createEntry($collection_uri, $entry, $name); \& \& my $feed = $client\->getFeed($collection_uri); \& my @entries = $feed\->entries; \& \& $entry = $client\->getEntry($edit_uri); \& \& $client\->updateEntry($edit_uri, $entry); \& \& $client\->deleteEntry($edit_uri); \& \& # CRUD a Media Resource; assuming that the 1\-st collection supports \& # Media Resources \& my $collection_uri = $collections[1]\->href; \& \& my $name = \*(AqMy Photo\*(Aq; \& \& my $edit_uri = $client\->createMedia($collection_uri, \*(Aqsample1.png\*(Aq, \& \*(Aqimage/png\*(Aq, $name); \& \& # Get a href attribute of an "edit\-media" link \& my $edit_media_uri = $client\->resource\->edit_media_link; \& \& my $binary = $client\->getMedia($edit_media_uri); \& \& $client\->updateMedia($edit_media_uri, \*(Aqsample2.png\*(Aq, \*(Aqimage/png\*(Aq); \& \& $client\->deleteEntry($edit_media_uri); \& \& # Access to the requested HTTP::Request object \& my $request = $client\->request; \& \& # Access to the received HTTP::Response object \& my $response = $client\->response; \& \& # Access to the received resource (XML::Atom object or binary data) \& my $resource = $client\->resource; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Atompub::Client implements a client for the Atom Publishing Protocol described at . .PP The client supports the following features: .IP "\(bu" 4 Authentication .Sp Atompub::Client supports the Basic and \s-1WSSE\s0 Authentication described in . .IP "\(bu" 4 Service Document .Sp Atompub::Client understands Service Documents, in which information of collections are described, such as URIs, acceptable media types, and allowable categories. .IP "\(bu" 4 Media Resource support .Sp Media Resources (binary data) as well as Entry Resources are supported. You can create and edit Media Resources such as image and video by using Atompub::Client. .IP "\(bu" 4 Media type check .Sp Atompub::Client checks media types of resources before creating and editing them to the collection. Acceptable media types are shown in \fIapp:accept\fR elements in the Service Document. .IP "\(bu" 4 Category check .Sp Atompub::Client checks categories in Entry Resources before creating and editing them to the collection. Allowable categories are shown in \fIapp:categories\fR elements in the Service Document. .IP "\(bu" 4 Cache controll and versioning .Sp On-memory cache and versioning, which are controlled by \fIETag\fR and \fILast-Modified\fR header, are implemented in Atompub::Client. .IP "\(bu" 4 Naming resources by \fISlug\fR header .Sp The client can specify \fISlug\fR header when creating a resource, which may be used as part of the resource \s-1URI.\s0 .SH "METHODS" .IX Header "METHODS" .ie n .SS "Atompub::Client\->new([ %options ])" .el .SS "Atompub::Client\->new([ \f(CW%options\fP ])" .IX Subsection "Atompub::Client->new([ %options ])" Creates a new Atompub client object. The options are same as LWP::UserAgent. .ie n .SS "$client\->getService($service_uri)" .el .SS "\f(CW$client\fP\->getService($service_uri)" .IX Subsection "$client->getService($service_uri)" Retrieves a Service Document at \s-1URI\s0 \f(CW$service_uri\fR. .PP Returns an XML::Atom::Service object on success, false otherwise. .ie n .SS "$client\->getCategories($category_uri)" .el .SS "\f(CW$client\fP\->getCategories($category_uri)" .IX Subsection "$client->getCategories($category_uri)" Retrieves a Category Document at \s-1URI\s0 \f(CW$category_uri\fR. .PP Returns an XML::Atom::Categories object on success, false otherwise. .ie n .SS "$client\->getFeed($collection_uri)" .el .SS "\f(CW$client\fP\->getFeed($collection_uri)" .IX Subsection "$client->getFeed($collection_uri)" Retrieves a Feed Document from the collection at \s-1URI\s0 \f(CW$collection_uri\fR. .PP Returns an XML::Atom::Feed object, false otherwise. .ie n .SS "$client\->createEntry($collection_uri, $entry, [ $slug ])" .el .SS "\f(CW$client\fP\->createEntry($collection_uri, \f(CW$entry\fP, [ \f(CW$slug\fP ])" .IX Subsection "$client->createEntry($collection_uri, $entry, [ $slug ])" Creates a new entry in the collection at \s-1URI\s0 \f(CW$collection_uri\fR. .PP \&\f(CW$entry\fR must be an XML::Atom::Entry object. .PP If \f(CW$slug\fR is provided, it is set in \fISlug\fR header and may be used as part of the resource \s-1URI.\s0 .PP Returns a \fILocation\fR header, which contains a \s-1URI\s0 of the newly created resource, or false on error. .ie n .SS "$client\->createMedia($collection_uri, $media, $media_type, [ $slug ])" .el .SS "\f(CW$client\fP\->createMedia($collection_uri, \f(CW$media\fP, \f(CW$media_type\fP, [ \f(CW$slug\fP ])" .IX Subsection "$client->createMedia($collection_uri, $media, $media_type, [ $slug ])" Creates a new Media Resource and a Media Link Entry in the collection at \s-1URI\s0 \f(CW$collection_uri\fR. .PP If \f(CW$media\fR is a reference to a scalar, it is treated as the binary. If a scalar, treated as a file containing the Media Resource. .PP \&\f(CW$media_type\fR is the media type of the Media Resource, such as 'image/png'. .PP \&\f(CW$slug\fR is set in the \fISlug\fR header, and may be used as part of the resource \s-1URI.\s0 .PP Returns a \fILocation\fR header, which contains a \s-1URI\s0 of the newly created resource, or false on error. .ie n .SS "$client\->getEntry($edit_uri)" .el .SS "\f(CW$client\fP\->getEntry($edit_uri)" .IX Subsection "$client->getEntry($edit_uri)" Retrieves an Entry Document with the given \s-1URI\s0 \f(CW$edit_uri\fR. .PP Returns an XML::Atom::Entry object on success, false otherwise. If the server returns 304 (Not Modified), returns a cache of the Media Resource. .ie n .SS "$client\->getMedia($edit_uri)" .el .SS "\f(CW$client\fP\->getMedia($edit_uri)" .IX Subsection "$client->getMedia($edit_uri)" Retrieves a Media Resource with the given \s-1URI\s0 \f(CW$edit_uri\fR. .PP Returns binary data of the Media Resource on success, false otherwise. If the server returns 304 (Not Modified), returns a cache of the Media Resource. .ie n .SS "$client\->updateEntry($edit_uri, $entry)" .el .SS "\f(CW$client\fP\->updateEntry($edit_uri, \f(CW$entry\fP)" .IX Subsection "$client->updateEntry($edit_uri, $entry)" Updates the Entry Document at \s-1URI\s0 \f(CW$edit_uri\fR with the new Entry Document \f(CW$entry\fR, which must be an XML::Atom::Entry object. .PP Returns true on success, false otherwise. .ie n .SS "$client\->updateMedia($edit_uri, $media, $media_type)" .el .SS "\f(CW$client\fP\->updateMedia($edit_uri, \f(CW$media\fP, \f(CW$media_type\fP)" .IX Subsection "$client->updateMedia($edit_uri, $media, $media_type)" Updates the Media Resource at \s-1URI\s0 \f(CW$edit_uri\fR with the \f(CW$media\fR. .PP If \f(CW$media\fR is a reference to a scalar, it is treated as the binary. If a scalar, treated as a file containing the Media Resource. .PP \&\f(CW$media_type\fR is the media type of the Media Resource, such as 'image/png'. .PP Returns true on success, false otherwise. .ie n .SS "$client\->deleteEntry($edit_uri)" .el .SS "\f(CW$client\fP\->deleteEntry($edit_uri)" .IX Subsection "$client->deleteEntry($edit_uri)" Deletes the Entry Document at \s-1URI\s0 \f(CW$edit_uri\fR. .PP Returns true on success, false otherwise. .ie n .SS "$client\->deleteMedia($edit_uri)" .el .SS "\f(CW$client\fP\->deleteMedia($edit_uri)" .IX Subsection "$client->deleteMedia($edit_uri)" Deletes the Media Resource at \s-1URI\s0 \f(CW$edit_uri\fR and related Media Link Entry. .PP Returns true on success, false otherwise. .SH "Accessors" .IX Header "Accessors" .ie n .SS "$client\->username([ $username ])" .el .SS "\f(CW$client\fP\->username([ \f(CW$username\fP ])" .IX Subsection "$client->username([ $username ])" If called with an argument, sets the username for login to \f(CW$username\fR. .PP Returns the current username that will be used when logging in to the Atompub server. .ie n .SS "$client\->password([ $password ])" .el .SS "\f(CW$client\fP\->password([ \f(CW$password\fP ])" .IX Subsection "$client->password([ $password ])" If called with an argument, sets the password for login to \f(CW$password\fR. .PP Returns the current password that will be used when logging in to the Atompub server. .ie n .SS "$client\->proxy([ $proxy_uri ])" .el .SS "\f(CW$client\fP\->proxy([ \f(CW$proxy_uri\fP ])" .IX Subsection "$client->proxy([ $proxy_uri ])" If called with an argument, sets \s-1URI\s0 of proxy server like 'http://proxy.example.com:8080'. .PP Returns the current \s-1URI\s0 of the proxy server. .ie n .SS "$client\->resource" .el .SS "\f(CW$client\fP\->resource" .IX Subsection "$client->resource" .ie n .SS "$client\->rc" .el .SS "\f(CW$client\fP\->rc" .IX Subsection "$client->rc" An accessor for Entry or Media Resource, which was retrieved in the previous action. .ie n .SS "$client\->request" .el .SS "\f(CW$client\fP\->request" .IX Subsection "$client->request" .ie n .SS "$client\->req" .el .SS "\f(CW$client\fP\->req" .IX Subsection "$client->req" An accessor for an HTTP::Request object, which was used in the previous action. .ie n .SS "$client\->response" .el .SS "\f(CW$client\fP\->response" .IX Subsection "$client->response" .ie n .SS "$client\->res" .el .SS "\f(CW$client\fP\->res" .IX Subsection "$client->res" An accessor for an HTTP::Response object, which was used in the previous action. .SH "INTERNAL INTERFACES" .IX Header "INTERNAL INTERFACES" .ie n .SS "$client\->init" .el .SS "\f(CW$client\fP\->init" .IX Subsection "$client->init" .ie n .SS "$client\->ua" .el .SS "\f(CW$client\fP\->ua" .IX Subsection "$client->ua" Accessor to the UserAgent. .ie n .SS "$client\->info" .el .SS "\f(CW$client\fP\->info" .IX Subsection "$client->info" An accessor to information of Collections described in a Service Document. .ie n .SS "$client\->cache" .el .SS "\f(CW$client\fP\->cache" .IX Subsection "$client->cache" An accessor to the resource cache. .ie n .SS "$client\->munge_request($req)" .el .SS "\f(CW$client\fP\->munge_request($req)" .IX Subsection "$client->munge_request($req)" .ie n .SS "$client\->_clear" .el .SS "\f(CW$client\fP\->_clear" .IX Subsection "$client->_clear" .ie n .SS "$client\->_get_service(\e%args)" .el .SS "\f(CW$client\fP\->_get_service(\e%args)" .IX Subsection "$client->_get_service(%args)" .ie n .SS "$client\->_get_categories(\e%args)" .el .SS "\f(CW$client\fP\->_get_categories(\e%args)" .IX Subsection "$client->_get_categories(%args)" .ie n .SS "$client\->_get_feed(\e%args)" .el .SS "\f(CW$client\fP\->_get_feed(\e%args)" .IX Subsection "$client->_get_feed(%args)" .ie n .SS "$client\->_create_resource(\e%args)" .el .SS "\f(CW$client\fP\->_create_resource(\e%args)" .IX Subsection "$client->_create_resource(%args)" .ie n .SS "$client\->_get_resource(\e%args)" .el .SS "\f(CW$client\fP\->_get_resource(\e%args)" .IX Subsection "$client->_get_resource(%args)" .ie n .SS "$client\->_update_resource(\e%args)" .el .SS "\f(CW$client\fP\->_update_resource(\e%args)" .IX Subsection "$client->_update_resource(%args)" .ie n .SS "$client\->_delete_resource(\e%args)" .el .SS "\f(CW$client\fP\->_delete_resource(\e%args)" .IX Subsection "$client->_delete_resource(%args)" .SH "ERROR HANDLING" .IX Header "ERROR HANDLING" Methods return \f(CW\*(C`undef\*(C'\fR on error, and the error message can be retrieved using the \fIerrstr\fR method. .SH "SEE ALSO" .IX Header "SEE ALSO" XML::Atom XML::Atom::Service Atompub .SH "AUTHOR" .IX Header "AUTHOR" Takeru \s-1INOUE,\s0 .SH "LICENCE AND COPYRIGHT" .IX Header "LICENCE AND COPYRIGHT" Copyright (c) 2007, Takeru \s-1INOUE \s0\f(CW\*(C`\*(C'\fR. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" \&\s-1BECAUSE 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 \*(L"AS IS\*(R" 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.\s0 .PP \&\s-1IN 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 \s0(\s-1INCLUDING 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\s0), \s-1EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\s0