1WWW::Pastebin::PastebinUCsoemr::CCornetartieb(u3t)ed PerWlWWD:o:cPuamsetnetbaitni:o:nPastebinCom::Create(3)
2
3
4
6 WWW::Pastebin::PastebinCom::Create - paste to <http://pastebin.com>
7 from Perl.
8
10 use strict;
11 use warnings;
12
13 use WWW::Pastebin::PastebinCom::Create;
14
15 my $paste = WWW::Pastebin::PastebinCom::Create->new;
16
17 $paste->paste( text => 'lots and lost of text to paste' )
18 or die "Error: " . $paste->error;
19
20 print "Your paste can be found on $paste\n";
21
23 The module provides means of pasting large texts into
24 <http://pastebin.com> pastebin site.
25
27 new
28 my $paste = WWW::Pastebin::PastebinCom::Create->new;
29
30 my $paste = WWW::Pastebin::PastebinCom::Create->new(
31 timeout => 10,
32 );
33
34 my $paste = WWW::Pastebin::PastebinCom::Create->new(
35 ua => LWP::UserAgent->new(
36 timeout => 10,
37 agent => 'PasterUA',
38 ),
39 );
40
41 Constructs and returns a brand new yummy juicy
42 WWW::Pastebin::PastebinCom::Create object. Takes two arguments, both
43 are optional. Possible arguments are as follows:
44
45 timeout
46
47 ->new( timeout => 10 );
48
49 Optional. Specifies the "timeout" argument of LWP::UserAgent's
50 constructor, which is used for pasting. Defaults to: 30 seconds.
51
52 ua
53
54 ->new( ua => LWP::UserAgent->new( agent => 'Foos!' ) );
55
56 Optional. If the "timeout" argument is not enough for your needs of
57 mutilating the LWP::UserAgent object used for pasting, feel free to
58 specify the "ua" argument which takes an LWP::UserAgent object as a
59 value. Note: the "timeout" argument to the constructor will not do
60 anything if you specify the "ua" argument as well. Defaults to: plain
61 boring default LWP::UserAgent object with "timeout" argument set to
62 whatever "WWW::Pastebin::PastebinCom::Create"'s "timeout" argument is
63 set to as well as "agent" argument is set to mimic Firefox.
64
66 paste
67 $paste->paste( text => 'long long text' )
68 or die "Failed to paste: " . $paste->error;
69
70 my $paste_uri = $paste->paste(
71 text => 'long long text',
72 format => 'perl',
73 poster => 'Zoffix',
74 expiry => 'm',
75 subdomain => 'subdomain',
76 private => 0,
77 ) or die "Failed to paste: " . $paste->error;
78
79 Instructs the object to pastebin some text. If pasting succeeded
80 returns a URI pointing to your paste, otherwise returns either "undef"
81 or an empty list (depending on the context) and the reason for the
82 failure will be avalable via "error()" method (see below).
83
84 Note: you don't have to store the return value. There is a
85 "paste_uri()" method as well as overloaded construct; see "paste_uri()"
86 method's description below.
87
88 Takes one mandatory and three optional arguments which are as follows:
89
90 text
91
92 ->paste( text => 'long long long long text to paste' );
93
94 Mandatory. The "text" argument must contain the text to paste. If
95 "text"'s value is undefined the "paste()" method will return either
96 "undef" or an empty list (depending on the context) and the "error()"
97 method will contain a message about undefined "text".
98
99 format
100
101 ->paste( text => 'foo', format => 'perl' );
102
103 Optional. Specifies the format of the paste to enable specific syntax
104 highlights on <http://pastebin.com>. The list of possible values is
105 very long, see "get_valid_formats()" method below for information on
106 how to obtain possible valid values for the "format" argument.
107 Defaults to: "text" (plain text paste).
108
109 poster
110
111 ->paste( text => 'foo', poster => 'Zoffix Znet' );
112
113 Optional. Specifies the name of the person pasting the text. Defaults
114 to: empty string, which leads to "Anonymous" apearing on
115 <http://pastebin.com>
116
117 expiry
118
119 ->paste( text => 'foo', expiry => 'f' );
120
121 Optional. Specifies when the paste should expire. Defaults to: "d"
122 (expire the paste in one day). Takes three possible values:
123
124 d When "expiry" is set to value "d", the paste will expire in one
125 day.
126
127 m When "expiry" is set to value "m", the paste will expire in one
128 month.
129
130 f When "expiry" is set to value "f", the paste will (should) stick
131 around "forever".
132
133 "subdomain"
134
135 subdomain => 'private_domain'
136
137 Optional. Allows one to paste into a so called "private" pastebin with
138 a personal domain name. Takes the domain name.
139
140 "uri"
141
142 uri => 'http://private_domain.pastebin.com/'
143
144 DEPRECATED. use "subdomain".
145
146 error
147 $paste->paste( text => 'foos' )
148 or die "Error: " . $paste->error;
149
150 If the "paste()" method failed to paste your text for any reason
151 (including your text being undefined) it will return either "undef" or
152 an empty list depending on the context. When that happens you will be
153 able to find out the reason of the error via "error()" method. Returns
154 a scalar containing human readable message describing the error. Takes
155 no arguments.
156
157 paste_uri (and overloads)
158 print "You can find your pasted text on " . $paste->paste_uri . "\n";
159
160 # or by interpolating the WWW::Pastebin::PastebinCom::Create object directly:
161 print "You can find your pasted text on $paste\n";
162
163 Takes no arguments. Returns a URI pointing to the <http://pastebin.com>
164 page containing the text you have pasted. If you call this method
165 before pasting anything or if "paste()" method failed the "paste_uri"
166 will return either "undef" or an empty list depending on the context.
167
168 Note: the WWW::Pastebin::PastebinCom::Create object is overloaded so
169 instead of calling "paste_uri" method you could simply interpolate the
170 WWW::Pastebin::PastebinCom::Create object. For example:
171
172 my $paster = WWW::Pastebin::PastebinCom::Create->new;
173 $paster->paste( text => 'long text' )
174 or die "Failed to paste: " . $paster->error;
175
176 print "Your paste is located on $paster\n";
177
178 get_valid_formats
179 my $valid_formats_hashref = $paste->get_valid_formats;
180
181 Takes no arguments. Returns a hashref, keys of which will be valid
182 values of the "format" argument to "paste()" method and values of which
183 will be explanation of semi-cryptic codes.
184
186 Zoffix Znet, "<zoffix at cpan.org>" (<http://zoffix.com>,
187 <http://haslayout.net>, http://mind-power-book.com/ <http://mind-power-
188 book.com/>)
189
190 Patches by Diab Jerius (DJERIUS)
191
193 Please report any bugs or feature requests to
194 "bug-www-pastebin-pastebincom-create at rt.cpan.org", or through the
195 web interface at
196 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Pastebin-PastebinCom-Create
197 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Pastebin-
198 PastebinCom-Create>. I will be notified, and then you'll automatically
199 be notified of progress on your bug as I make changes.
200
202 You can find documentation for this module with the perldoc command.
203
204 perldoc WWW::Pastebin::PastebinCom::Create
205
206 You can also look for information at:
207
208 · RT: CPAN's request tracker
209
210 http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Pastebin-PastebinCom-Create
211 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Pastebin-PastebinCom-
212 Create>
213
214 · AnnoCPAN: Annotated CPAN documentation
215
216 http://annocpan.org/dist/WWW-Pastebin-PastebinCom-Create
217 <http://annocpan.org/dist/WWW-Pastebin-PastebinCom-Create>
218
219 · CPAN Ratings
220
221 http://cpanratings.perl.org/d/WWW-Pastebin-PastebinCom-Create
222 <http://cpanratings.perl.org/d/WWW-Pastebin-PastebinCom-Create>
223
224 · Search CPAN
225
226 http://search.cpan.org/dist/WWW-Pastebin-PastebinCom-Create
227 <http://search.cpan.org/dist/WWW-Pastebin-PastebinCom-Create>
228
230 Copyright 2008 Zoffix Znet, all rights reserved.
231
232 This program is free software; you can redistribute it and/or modify it
233 under the same terms as Perl itself.
234
235
236
237perl v5.12.0 2010-05-W0W7W::Pastebin::PastebinCom::Create(3)