Zoffix Znet


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


    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";


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



    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:


    ->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


    ->new( timeout => 10 );

Optional. Specifies the timeout argument of LWP::UserAgent's constructor, which is used for pasting. Defaults to: 30 seconds.


    ->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.



    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:


    ->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)


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

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


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

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


    ->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.


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

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


    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.


    my $old_site = $paster->site;


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.


    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().


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


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.


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 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.