NAME

WWW::PasteCSSStandardsOrg::Create - create new pastes on http://paste.css-standards.org website

SYNOPSIS

use strict;
use warnings;

use WWW::PasteCSSStandardsOrg::Create;

my $paster = WWW::PasteCSSStandardsOrg::Create->new;

$paster->paste( 'text to paste', expire => 'day', )
    or die $paster->error;

printf "Your paste is located on: %s\n", $paster->uri;

DESCRIPTION

The module provides means of pasting large texts into http://paste.css-standards.org pastebin site.

CONSTRUCTOR

new

my $paster = WWW::PasteCSSStandardsOrg::Create->new;

my $paster = WWW::PasteCSSStandardsOrg::Create->new( timeout => 10 );

my $paster = WWW::PasteCSSStandardsOrg::Create->new(
    mech => WWW::Mechanize->new( agent => '007', timeout => 10 ),
);

Bakes and returns a fresh WWW::PasteCSSStandardsOrg::Create object. Takes two optional arguments which are as follows:

timeout

my $paster = WWW::PasteCSSStandardsOrg::Create->new( timeout => 10 );

Takes a scalar as a value which is the value that will be passed to the WWW::Mechanize object to indicate connection timeout in seconds. Defaults to: 30 seconds

mech

my $paster = WWW::PasteCSSStandardsOrg::Create->new(
    mech => WWW::Mechanize->new( agent => '007', timeout => 10 ),
);

If a simple timeout is not enough for your needs feel free to specify the mech argument which takes a WWW::Mechanize object as a value. Defaults to: plain WWW::Mechanize object with timeout argument set to whatever WWW::PasteCSSStandardsOrg::Create's timeout argument is set to as well as agent argument is set to mimic FireFox.

METHODS

paste

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

my $uri2 = $paster->paste(
    'some long text',
    name        => 'Zoffix',
    expire      => 'never',
    desc        => 'some codes',
    lang        => 'css',
) or die $paster->error;

Instructs the object to create a new paste. If an error occured during pasting the method will return either undef or an empty list depending on the context and the error will be available via error() method. On success returns a URI object poiting to the newly created paste (see also uri() method). The first argument is mandatory content of your paste. The rest are optional arguments which are passed in a key/value pairs. Note: pastebin blocks pastes which are shorter than 20 characters. The module will return an error if your text is shorter. The optional arguments are as follows:

name

{ name    => 'Zoffix' }

Optional. Takes a scalar as an argument which specifies the name of the poster or the titles of the paste. Defaults to: empty string, which in turn results to word Stuff being the title of the paste. Defaults to: empty string which in turn results to 'Anonymous' as a name.

expire

{ expire => 'never' }

Optional. When your paste should expire. Defaults to: week. Valid values are:

day

Expire in 24 hours

week

Expire in 7 days

month

Expire in a month

quarter

Expire in three months

year

Expire in a year

never

Paste should never expire.

desc

{ desc => 'some codes' }

Optional. The description of the paste. Defaults to: empty string.

lang

{ lang => 'css' }

Optional. Specifies the (computer) language of the paste, in other words what syntax highlights to use. Defaults to: none. Valid values are:

none

No highlights, raw text.

css

CSS code.

html4strict

HTML 4.01 Strict code.

javascript

Javascript code

xml

XML (XHTML) code

error

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

If an error occured during the call to paste() method it will return either undef or an empty list depending on the context and the error will be available via error(). Takes no arguments, returns a human parsable message explaining why paste() failed.

uri

my $last_uri = $paster->uri;

Must be called after a successfull call to paste(). Takes no arguments, returns a URI object poiting to the newly created paste, i.e. the return value of the last call to paste().

mech

my $old_mech = $paster->mech;

$paster->mech( WWW::Mechanize->new( agent => 'blah' ) );

Returns a WWW::Mechanize object used for pasting. When called with an optional argument (which must be a WWW::Mechanize object) will use it in any subsequent paste() calls.

AUTHOR

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

BUGS

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