Atompub::Client(3pm)
π Atompub::Client π
okay so bestie, welcome to the manual page for Atompub::Client β yes that (3pm) at the end means it's a Perl module manual, and yes I'm about to make the Atom Publishing Protocol feel like a group chat. This is the client. It talks to AtomPub servers so you don't have to. Let's get into it, no cap. π¦
β¨ NAME β¨
Atompub::Client β A client for the Atom Publishing Protocol
πΈ SYNOPSIS πΈ
Here's the whole vibe in code, bestie. Read it top to bottom, it's literally the entire lifecycle:
use Atompub::Client;
my $client = Atompub::Client->new;
$client->username('Melody');
$client->password('Nelson');
#$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 = 'New Post';
my $entry = XML::Atom::Entry->new;
$entry->title($name);
$entry->content('Content of my post.');
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 = 'My Photo';
my $edit_uri = $client->createMedia($collection_uri, 'sample1.png',
'image/png', $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, 'sample2.png', 'image/png');
$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;
π«Ά DESCRIPTION π«Ά
Atompub::Client implements a client for the Atom Publishing Protocol β that's the one described at <http://www.ietf.org/rfc/rfc5023.txt>. iykyk.
And the client is doing a LOT for you, okay? Here's everything it supports:
- Authentication π
Atompub::Clientsupports the Basic and WSSE Authentication described in <http://www.intertwingly.net/wiki/pie/DifferentlyAbledClients>. - Service Document π
Atompub::Clientunderstands Service Documents, in which information of collections are described, such as URIs, acceptable media types, and allowable categories. - Media Resource support πΌοΈ 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. - Media type check β
Atompub::Clientchecks media types of resources before creating and editing them to the collection. Acceptable media types are shown inapp:acceptelements in the Service Document. - Category check π·οΈ
Atompub::Clientchecks categories in Entry Resources before creating and editing them to the collection. Allowable categories are shown inapp:categorieselements in the Service Document. - Cache controll and versioning β‘ On-memory cache and versioning, which are controlled by
ETagandLast-Modifiedheader, are implemented inAtompub::Client. - Naming resources by Slug header π The client can specify
Slugheader when creating a resource, which may be used as part of the resource URI.
(yes, the original really does spell it "controll" β we respect the canon here, bestie π)
π METHODS π
π Atompub::Client->new([ %options ])
Creates a new Atompub client object. The options are same as LWP::UserAgent. β¨
π $client->getService($service_uri)
Retrieves a Service Document at URI $service_uri.
Returns an XML::Atom::Service object on success, false otherwise.
π $client->getCategories($category_uri)
Retrieves a Category Document at URI $category_uri.
Returns an XML::Atom::Categories object on success, false otherwise.
π $client->getFeed($collection_uri)
Retrieves a Feed Document from the collection at URI $collection_uri.
Returns an XML::Atom::Feed object, false otherwise.
π $client->createEntry($collection_uri, $entry, [ $slug ])
Creates a new entry in the collection at URI $collection_uri.
$entry must be an XML::Atom::Entry object.
If $slug is provided, it is set in Slug header and may be used as part of the resource URI.
Returns a Location header, which contains a URI of the newly created resource, or false on error.
π $client->createMedia($collection_uri, $media, $media_type, [ $slug ])
Creates a new Media Resource and a Media Link Entry in the collection at URI $collection_uri.
If $media is a reference to a scalar, it is treated as the binary. If a scalar, treated as a file containing the Media Resource.
$media_type is the media type of the Media Resource, such as 'image/png'.
$slug is set in the Slug header, and may be used as part of the resource URI.
Returns a Location header, which contains a URI of the newly created resource, or false on error.
π $client->getEntry($edit_uri)
Retrieves an Entry Document with the given URI $edit_uri.
Returns an XML::Atom::Entry object on success, false otherwise. If the server returns 304 (Not Modified), returns a cache of the Media Resource.
π $client->getMedia($edit_uri)
Retrieves a Media Resource with the given URI $edit_uri.
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.
π $client->updateEntry($edit_uri, $entry)
Updates the Entry Document at URI $edit_uri with the new Entry Document $entry, which must be an XML::Atom::Entry object.
Returns true on success, false otherwise.
π $client->updateMedia($edit_uri, $media, $media_type)
Updates the Media Resource at URI $edit_uri with the $media.
If $media is a reference to a scalar, it is treated as the binary. If a scalar, treated as a file containing the Media Resource.
$media_type is the media type of the Media Resource, such as 'image/png'.
Returns true on success, false otherwise.
π $client->deleteEntry($edit_uri)
Deletes the Entry Document at URI $edit_uri.
Returns true on success, false otherwise.
π $client->deleteMedia($edit_uri)
Deletes the Media Resource at URI $edit_uri and related Media Link Entry.
Returns true on success, false otherwise.
π Accessors π
β $client->username([ $username ])
If called with an argument, sets the username for login to $username.
Returns the current username that will be used when logging in to the Atompub server.
β $client->password([ $password ])
If called with an argument, sets the password for login to $password.
Returns the current password that will be used when logging in to the Atompub server.
β $client->proxy([ $proxy_uri ])
If called with an argument, sets URI of proxy server like 'http://proxy.example.com:8080'.
Returns the current URI of the proxy server.
β $client->resource
β $client->rc
An accessor for Entry or Media Resource, which was retrieved in the previous action.
β $client->request
β $client->req
An accessor for an HTTP::Request object, which was used in the previous action.
β $client->response
β $client->res
An accessor for an HTTP::Response object, which was used in the previous action.
π§ INTERNAL INTERFACES π§
These are the guts, bestie β the internals doing the behind-the-scenes work. Don't touch unless you know what you're doing. π
$client->init$client->uaβ Accessor to theUserAgent.$client->infoβ An accessor to information of Collections described in a Service Document.$client->cacheβ An accessor to the resource cache.$client->munge_request($req)$client->_clear$client->_get_service(\%args)$client->_get_categories(\%args)$client->_get_feed(\%args)$client->_create_resource(\%args)$client->_get_resource(\%args)$client->_update_resource(\%args)$client->_delete_resource(\%args)
Wait β let me give init and ua their proper label since they share one description: $client->init and $client->ua are both the accessor to the UserAgent. π«Ά
π ERROR HANDLING π
Methods return "undef" on error, and the error message can be retrieved using the errstr method.
not theundefjumpscare π but fr fr,errstris your bestie when things go sideways.
π₯ SEE ALSO π₯
XML::Atom XML::Atom::Service 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, legal voice on, but I'm keeping every word β this is important:
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 page, bestie β you ate that. π
β¨ This one's from perl v5.40.1, dated 2025-08-14, and it lives at Atompub::Client(3pm). Slay, go build something iconic π¦
π¦ where this page comes from
- ubuntu resolute: libatompub-perl 0.3.7-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libatompub-perl 0.3.7-7 Β· 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