develooper Front page | perl.perl5.porters | Postings from May 2013

Re: RFC: Removing CGI.pm from the core distribution

Thread Previous | Thread Next
From:
Tatsuhiko Miyagawa
Date:
May 28, 2013 05:56
Subject:
Re: RFC: Removing CGI.pm from the core distribution
Message ID:
CADGpoaPON9XpDKRvcPfWPkrH8x8u4im8fwDpmQP7E2--xMWRow@mail.gmail.com
On Mon, May 27, 2013 at 4:21 AM, Johan Vromans <jvromans@squirrel.nl> wrote:

> If I'd want a trivial web app that shows me yesterday's SinFest comic,
> I'd use CGI.pm and 10-20 lines of Perl code. It would work on every web
> host that has Perl.

I'm pretty sure that script would involve the code to fetch HTML page
from SinFest and parse it. It requires LWP (or some other HTTP
library) which is not in core. You can instead use wget, curl,
HTTP::Tiny for sure - none of them are guaranteed to be available on
"every web host that has Perl" anyway.

Instead, if you want to ensure your script works even when CGI.pm is
not shipped with Perl, or with an even worse provider that strips
modules like CGI.pm from perl core library (I know a few):

    > cpanm -l vendor --reinstall CGI

and add 'use lib "./vendor/lib/perl5"' to your script, then upload the
whole code and vendor directory, and you're done. You don't even need
a shell access or local::lib integration.

Adding LWP or HTTP::Tiny to that is also as trivial, so long as XS
module is not involved [1].

(Fatpacker is an alternative to this to do the same thing, but only
required if you need a single file executable)

[1] At this moment, installing CGI.pm requires FCGI which needs XS
binary to be built. As you can see on the thread I believe this will
be resolved soon so that it's not the case.

--
Tatsuhiko Miyagawa

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About