App::Nopaste(3pm)

πŸ“¦
version 1.013 Β· 6 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– App::Nopaste πŸ’–

okay bestie, so this is App::Nopaste, and it's living in the Perl docs (you'll see it filed as App::Nopaste(3pm) in the User Contributed Perl Documentation section β€” very demure, very mindul of the section number). Its whole entire vibe is: easy access to any pastebin. That's it. That's the mission. πŸŽ€


✨ NAME ✨

App::Nopaste β€” literally just Easy access to any pastebin. Short. Iconic. No notes. πŸ’…


🌸 VERSION 🌸

version 1.013

(yes we know exactly which one, we do not play about versions) ⭐


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the moment you've been waiting for, the little taste:

use App::Nopaste 'nopaste';

my $url = nopaste(q{
    perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' [number]
});

# or on the command line:
nopaste test.pl
=> http://pastebin.com/fcba51f

like. look at that. one line and your whole code situation is posted. 😭🫢


🌈 DESCRIPTION 🌈

so pastebins (a.k.a. nopaste sites, same thing bestie, don't let anyone gatekeep the terminology) are these places where you post text β€” usually code β€” and it's just, like, publicly viewable. and the reason they exist at all? IRC channels. because you'd be sitting in a channel wanting to show someone your code and it's simply Too Long to paste directly in the channel. hence the name nopaste. the way that's actually genius naming. πŸ‘‘

but here's the drama: every single pastebin is slightly different. each one is doing its own little thing. and when one pastebin goes down β€” and we're all looking at you, <http://paste.husk.org> β€” you have to go find a new one like it's a quest. and if you usually use a script to publish your text? that's just so much hassle. exhausting. not the move.

so THIS module is here to smooth out all those differences between pastebins, and it also gives you redundancy: if one site doesn't work, it just tries a different one. no big deal. no meltdown. it just moves on. resilient queen. πŸ’ͺ

and it's modular too!! you only need to put an App::Nopaste::Service::Foo module up on CPAN and literally anyone can start using it. that's the ecosystem. that's community. 🫢


πŸ’œ INTERFACE πŸ’œ

πŸŽ€ CLI πŸŽ€

the docs for that live over in App::Nopaste::Command β€” go peek at it, iykyk.

⭐ "nopaste" ⭐

okay so here's the whole function, laid out, every single argument:

use App::Nopaste 'nopaste';

my $url = nopaste(
    text => "Full text to paste (the only mandatory argument)",
    desc => "A short description of the paste",
    nick => "Your nickname",
    lang => "perl",
    chan => "#moose",
    private => 1, # default: 0

    # this is the default, but maybe you want to do something different
    error_handler => sub {
        my ($error, $service) = @_;
        warn "$service: $error";
    },

    warn_handler => sub {
        my ($warning, $service) = @_;
        warn "$service: $warning";
    },

    # you may specify the services to use - but you don't have to
    services => ["Shadowcat", "Gist"],
);

print $url if $url;

quick rundown of the whole cast, one bullet each so nobody gets lost:

  • text β€” the full text you wanna paste. this is the only mandatory argument, everything else is optional. the main character, honestly. πŸ‘‘
  • desc β€” a short description of the paste.
  • nick β€” your nickname.
  • lang β€” the language, e.g. "perl".
  • chan β€” the channel, e.g. "#moose".
  • private β€” default: 0.
  • error_handler β€” this one's already the default, but maybe you wanna do something different. it gets called as a sub with the error message and the service that issued it.
  • warn_handler β€” gets called as a sub with the warning message and the service that issued it.
  • services β€” you may specify which services to use, but you don't have to. no pressure at all. it's giving optional.

and like, what does it actually return? listen:

the "nopaste" function will return the URL of the paste on success, or "undef" on failure. that's it. that's the contract. ✨

for each failure, the error_handler argument is invoked with the error message and the service that issued it.

for each warning, the warn_handler argument is invoked with the warning message and the service that issued it.

so you always know which little service was misbehaving. accountability. we love to see it. πŸ’…


🌟 SEE ALSO 🌟

go read these next, bestie, they're all part of the extended universe:


Copyright 2008- Shawn M Moore.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


🫢 SUPPORT 🫢

found a bug? (we hate that for you, but thank you for your service πŸ™ˆ) bugs may be submitted through the RT bug tracker:

<https://rt.cpan.org/Public/Dist/Display.html?Name=App-Nopaste>

or, if email is more your thing:

bug-App-Nopaste@rt.cpan.org <mailto:bug-App-Nopaste@rt.cpan.org>


πŸ’– AUTHOR πŸ’–

Shawn M Moore, <sartak@gmail.com>


🧚 CONTRIBUTORS 🧚

the whole squad, no cap, every single one of them:

  • Shawn M Moore <code@sartak.org>
  • Karen Etheridge <ether@cpan.org>
  • Thomas Sibley <tsibley@cpan.org>
  • Ricardo Signes <rjbs@cpan.org>
  • FranΓ§ois Gannaz <francois.gannaz@silecs.info>
  • Justin Hunter <justin.d.hunter@gmail.com>
  • Kevin Falcone <kevin@jibsheet.com>
  • Zoffix Znet <cpan@zoffix.com>
  • Jesse Luehrs <doy@tozt.net>
  • Dean Hamstead <dean@fragfest.com.au>
  • David Golden <dagolden@cpan.org>
  • Rafael Kitover <rkitover@cpan.org>
  • Sergey Romanov <complefor@rambler.ru>
  • Zakariyya Mughal <zaki.mughal@gmail.com>
  • gregor herrmann <gregoa@debian.org>
  • vti <viacheslav.t@gmail.com>
  • Γ†var ArnfjΓΆrΓ° Bjarmason <avarab@gmail.com>
  • Π‘Π΅Ρ€Π³Π΅ΠΉ Π ΠΎΠΌΠ°Π½ΠΎΠ² <sromanov@cpan.org>
  • Andrew Rodland <andrew@cleverdomain.org>
  • Χ™Χ•Χ‘Χœ Χ§Χ•Χ’'מן (Yuval Kogman) <nothingmuch@woobling.org>
  • Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
  • Dan Book <grinnz@gmail.com>
  • Darian Anthony Patrick <dap@darianpatrick.com>
  • David Bremner <bremner@unb.ca>
  • David J. Shultz <djshultz@gmail.com>
  • Graham Knop <haarg@haarg.org>
  • Jason Mills <jmmills@cpan.org>
  • John Goulah <jgoulah@gmail.com>
  • Maximilian Gass <mxey@ghosthacking.net>
  • Sebastian Paaske TΓΈrholm <Eckankar+github@gmail.com>
  • Shlomi Fish <shlomif@shlomifish.org>
  • Tatsuhiko Miyagawa <miyagawa@bulknews.net>

This software is copyright (c) 2008 by Shawn M Moore.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page, bestie!! πŸŽ€ one last little sign-off so you know exactly what you're looking at: this doc came to you from perl v5.36.0, dated 2022-08-28, and it's filed under App::Nopaste(3pm). stan a pastebin wrapper that just works βœ¨πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from