NAME WWW::Pastebin::Sprunge::Retrieve - Retrieves pastes from the sprunge.us pastebin VERSION version 0.001 SYNOPSIS use strict; use warnings; use WWW::Pastebin::Sprunge::Retrieve; my $paster = WWW::Pastebin::Sprunge::Retrieve->new(); my $content = $paster->retrieve('http://sprunge.us/84Pc') or die $paster->error(); print $content; DESCRIPTION The module provides interface to retrieve pastes from website via Perl. METHODS "new" my $paster = WWW::Pastebin::Sprunge::Retrieve->new(); my $paster = WWW::Pastebin::Sprunge::Retrieve->new( timeout => 10, ); my $paster = WWW::Pastebin::Sprunge::Retrieve->new( ua => LWP::UserAgent->new( timeout => 10, agent => 'PasterUA', ), ); Constructs and returns a new WWW::Pastebin::Sprunge::Retrieve object. Takes two arguments, both are *optional*. Possible arguments are as follows: "timeout" ->new( timeout => 10 ); Optional. Specifies the "timeout" argument of LWP::UserAgent's constructor, which is used for retrieving. Defaults to: 30 seconds. "ua" ->new( ua => LWP::UserAgent->new( agent => 'Foos!' ) ); If the "timeout" argument is not enough for your needs, feel free to specify the "ua" argument which takes an LWP::UserAgent object as a value. Note: the "timeout" argument to the constructor will not do anything if you specify the "ua" argument as well. Defaults to: plain boring default LWP::UserAgent object with "timeout" argument set to whatever "WWW::Pastebin::Sprunge::Retrieve"'s "timeout" argument is set to as well as "agent" argument is set to mimic Firefox. "retrieve" my $content = $paster->retrieve('http://sprunge.us/SCLg') or die $paster->error(); my $content = $paster->retrieve('SCLg') or die $paster->error(); Instructs the object to retrieve a paste specified in the argument. Takes one mandatory argument which can be either a full URI to the paste you want to retrieve or just its ID. On failure returns either "undef" or an empty list depending on the context and the reason for the error will be available via "error()" method. On success, returns the pasted text. "error" $paster->retrieve('SCLg') or die $paster->error; On failure "retrieve()" returns either "undef" or an empty list depending on the context and the reason for the error will be available via "error()" method. Takes no arguments, returns an error message explaining the failure. "id" my $paste_id = $paster->id; Must be called after a successful call to "retrieve()". Takes no arguments, returns a paste ID number of the last retrieved paste irrelevant of whether an ID or a URI was given to "retrieve()" "uri" my $paste_uri = $paster->uri; Must be called after a successful call to "retrieve()". Takes no arguments, returns a URI object with the URI pointing to the last retrieved paste irrelevant of whether an ID or a URI was given to "retrieve()" "results" my $last_results_ref = $paster->results; Must be called *after* a successful call to "retrieve()". Takes no arguments, returns the exact same string as the last call to "retrieve()" returned. See "retrieve()" method for more information. "content" my $paste_content = $paster->content; print "Paste content is:\n$paster\n"; Must be called after a successful call to "retrieve()". Takes no arguments, returns the actual content of the paste. Note: this method is overloaded for this module for interpolation. Thus you can simply interpolate the object in a string to get the contents of the paste. "ua" my $old_LWP_UA_obj = $paster->ua; $paster->ua( LWP::UserAgent->new( timeout => 10, agent => 'foos' ); Returns a currently used LWP::UserAgent object used for retrieving pastes. Takes one optional argument which must be an LWP::UserAgent object, and the object you specify will be used in any subsequent calls to "retrieve()". AVAILABILITY The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit to find a CPAN site near you, or see . The development version lives at and may be cloned from . Instead of sending patches, please fork this project using the standard git and github infrastructure. BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests through the web interface at . AUTHOR Mike Doherty COPYRIGHT AND LICENSE This software is Copyright (c) 2010 by Mike Doherty. This is free software, licensed under: The GNU General Public License, Version 3, June 2007