1App::Nopaste(3) User Contributed Perl Documentation App::Nopaste(3)
2
3
4
6 App::Nopaste - easy access to any pastebin
7
9 use App::Nopaste 'nopaste';
10
11 my $url = nopaste(q{
12 perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' [number]
13 });
14
15 # or on the command line:
16 nopaste test.pl
17 => http://pastebin.com/fcba51f
18
20 Pastebins (also known as nopaste sites) let you post text, usually
21 code, for public viewing. They're used a lot in IRC channels to show
22 code that would normally be too long to give directly in the channel
23 (hence the name nopaste).
24
25 Each pastebin is slightly different. When one pastebin goes down (I'm
26 looking at you, <http://paste.husk.org>), then you have to find a new
27 one. And if you usually use a script to publish text, then it's too
28 much hassle.
29
30 This module aims to smooth out the differences between pastebins, and
31 provides redundancy: if one site doesn't work, it just tries a
32 different one.
33
34 It's also modular: you only need to put on CPAN a
35 App::Nopaste::Service::Foo module and anyone can begin using it.
36
38 CLI
39 See the documentation in App::Nopaste::Command.
40
41 "nopaste"
42 use App::Nopaste 'nopaste';
43
44 my $url = nopaste(
45 text => "Full text to paste (the only mandatory argument)",
46 desc => "A short description of the paste",
47 nick => "Your nickname",
48 lang => "perl",
49 chan => "#moose",
50 private => 1, # default: 0
51
52 # this is the default, but maybe you want to do something different
53 error_handler => sub {
54 my ($error, $service) = @_;
55 warn "$service: $error";
56 },
57
58 warn_handler => sub {
59 my ($warning, $service) = @_;
60 warn "$service: $warning";
61 },
62
63 # you may specify the services to use - but you don't have to
64 services => ["Shadowcat", "Gist"],
65 );
66
67 print $url if $url;
68
69 The "nopaste" function will return the URL of the paste on success, or
70 "undef" on failure.
71
72 For each failure, the "error_handler" argument is invoked with the
73 error message and the service that issued it.
74
75 For each warning, the "warn_handler" argument is invoked with the
76 warning message and the service that issued it.
77
79 WebService::NoPaste, WWW::Pastebin::PastebinCom::Create,
80 Devel::REPL::Plugin::Nopaste
81
83 Shawn M Moore, "sartak@gmail.com"
84
86 Copyright 2008-2010 Shawn M Moore.
87
88 This program is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90
91
92
93perl v5.12.3 2011-08-26 App::Nopaste(3)