Why not adopt me?
NAME
WWW::PastebinCom::Retrieve - retrieve content of pastes from http://pastebin.com
SYNOPSIS
use strict;
use warnings;
use lib '../lib';
use WWW::PastebinCom::Retrieve;
my $paster = WWW::PastebinCom::Retrieve->new;
$paster->retrieve('d4b6531a9');
printf "Paste number %s:\n%sn",
$paster->paste_number,
$paster->content;
DESCRIPTION
The module provides means to retrieve the text from pastes on http://pastebin.com
CONSTRUCTOR
new
my $paster = WWW::PastebinCom::Retrieve->new;
my $paster = WWW::PastebinCom::Retrieve->new(
timeout => 10,
);
my $paster = WWW::PastebinCom::Retrieve->new(
ua => LWP::UserAgent->new(
timeout => 10,
agent => 'PasterUA',
),
);
Constructs and returns a brand new WWW::PastebinCom::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 pasting. Defaults to: 30
seconds.
ua
->new( ua => LWP::UserAgent->new( agent => 'Foos!' ) );
Optional. If the timeout
argument is not enough for your needs of mutilating the LWP::UserAgent object used for retrieving the pastes, 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::PastebinCom::Retrieve
's timeout
argument is set to as well as agent
argument is set to mimic Firefox.
METHODS
retrieve
$paster->retrieve('m1dbc0d8')
or die 'Error: ' . $paster->error;
my $paste_content = $paster->retrieve('http://pastebin.com/m1dbc0d8')
or die 'Error: ' . $paster->error;
Instructs the object to retrieve the paste specified as an argument. Takes one mandatory argument which can be either a full URI to the paste you wish to retrieve or just its number (or ID if you prefer so). The "paste number" is basically m1dbc0d8
in http://pastebin.com/m1dbc0d8
. Returns the textual content of the paste, number or URI of which you have specified. See also content()
method described below. If an error occured retrieve()
will return either undef
or an empty list depending on the context and the reason for the error will be available via error()
method (see below).
error
$paster->retrieve('m1dbc0d8')
or die 'Error: ' . $paster->error;
If retrieve()
failed to retrieve your paste for any reason it will return either undef
or an empty list depending on the context and the reason for the error will be available to you via error()
method. Takes no arguments. Returns a human readable reason for the error in a form of a scalar.
content
my $paste_content = $paster->content;
Must be called after a successfull call to retrieve()
. Takes no arguments, returns the content of the retrieved paste in a form of a scalar.
paste_number
$paster->retrieve('http://pastebin.com/m1dbc0d8')
my $paste_number = $paster->paste_number;
# $paste_number will contain 'm1dbc0d8'
Must be called after a call to retrieve()
. Takes no arguments, returns the paste number (or ID if you prefer) of the last paste retrieved.
AUTHOR
Zoffix Znet, <zoffix at cpan.org>
(http://zoffix.com, http://haslayout.net)
BUGS
Please report any bugs or feature requests to bug-www-pastebincom-retrieve at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-PastebinCom-Retrieve. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::PastebinCom::Retrieve
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-PastebinCom-Retrieve
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright 2008 Zoffix Znet, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.