NAME

WWW::Pastebin::Bot::Pastebot::Create - create pastes on sites powered by Bot::Pastebot

SYNOPSIS

use strict;
use warnings;

use WWW::Pastebin::Bot::Pastebot::Create;

my $paster = WWW::Pastebin::Bot::Pastebot::Create->new( site => 'http://http://p3m.org/pfn' );

$paster->paste( 'testing', summary => 'sorry just testing' )
    or die $paster->error;

print "Your paste is located on $paster\n";

DESCRIPTION

The module provides interface to paste into pastebin sites powered by Bot::Pastebot

CONSTRUCTOR

new

my $paste = WWW::Pastebin::Bot::Pastebot::Create->new;

my $paste = WWW::Pastebin::Bot::Pastebot::Create->new(
    site    => 'http://p3m.org/pfn'',
    timeout => 10,
);

my $paste = WWW::Pastebin::Bot::Pastebot::Create->new(
    ua => LWP::UserAgent->new(
        timeout => 10,
        agent   => 'PasterUA',
    ),
);

Constructs and returns a brand new yummy juicy WWW::Pastebin::Bot::Pastebot::Create object. Takes two arguments, both are optional. Possible arguments are as follows:

site

->new( site => 'http://p3m.org/pfn' )

Optional. Specifies the URI to pastebin site which is powered by Bot::Pastebot. Make you you don't append any "channel specific" paths. This is done internally by the module. Defaults to: http://p3m.org/pfn

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 pasting, 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::Bot::Pastebot::Create's timeout argument is set to as well as agent argument is set to mimic Firefox.

METHODS

paste

my $uri = $paster->paste('text to paste')
    or die $paster->error;

$paster->paste( 'text to paste',
    channel     => '#perl',
    nick        => 'Zoffix',
    summary     => 'some uber codez',
) or die $paster->error

Instructs the object to create a new paste. On failure will return either undef or an empty list depending on the context and the reason for failure will be available via error() method. On success returns a URI object poiting to a newly created paste. Takes one mandatory argument and several optional ones. The first argument is mandatory and is the text you want to paste. Optional arguments are passed as key/value pairs and are as follows:

channel

->paste( 'long text', channel => '#perl' );

Optional. Specifies the channel to which the pastebot will announce. Valid values vary as different pastebots configured for different channels, but the value would be the same as what you'd see in the "Channel" select box on the site. Specifying empty string will result in "No channel". Defaults to: '' (no specific channel)

nick

->paste( 'long text', nick => 'Zoffix' );

Optional. Specifies the name of the person creating the paste. Defaults to: '' (empty; no name)

summary

->paste( 'long text', summary => 'some uber codez' );

Optional. Specifies a short summary of the paste contents. Defaults to: '' (empty; no summary)

paste

->paste('', paste => $content );

Optional. Depending on how you are using the module it might be easier for you to specify anything as the first argument and provide the content of the paste as a paste argument. Defaults to: first argument to paste() method.

error

$paster->paste('text to paste')
    or die $paster->error;

Takes no arguments, returns the error message explaining why call to paste() method failed.

uri

my $paste_uri = $paster->uri;

print "Your paste is located on $paster\n";

Must be called after a successful call to paste(). Takes no arguments, returns a URI object last call to paste() created. Note: this method is overloaded for q|""| thus you can simply interpolate your object in a string to obtain the URI to the paste.

site

my $old_site = $paster->site;

$paster->site('http://p3m.org/pfn');

Returns a currently used paste site (see site argument to contructor). When called with its optional argument (which must be a URI pointing to a pastebin site powered by Bot::Pastebot) will use it for creating any subsequent pastes.

ua

my $ua_obj = $paster->ua;

$paster->ua( LWP::UserAgent->new( timeout => 10, agent => 'PasteUA' ) ):

Returns an LWP::UserAgent object which is used for creating pastes. Accepts one optional argument which must be an LWP::UserAgent object, if you specify it then whatever you specify will be used in subsequent calls to paste().

AUTHOR

Zoffix Znet, <zoffix at cpan.org> (http://zoffix.com, http://haslayout.net)

BUGS

Please report any bugs or feature requests to bug-www-pastebin-bot-pastebot-create at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Pastebin-Bot-Pastebot-Create. 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::Pastebin::Bot::Pastebot::Create

You can also look for information at:

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.