Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

fastcgi without the module

by morgon (Priest)
on Dec 01, 2020 at 19:57 UTC ( #11124470=perlquestion: print w/replies, xml ) Need Help??

morgon has asked for the wisdom of the Perl Monks concerning the following question:


I have a little openwrt-box with lighthttpd that can do fastcgi.

Unfortunately the way perl is packaged on openwrt is a bit strange (eg. when you only install the perl-package you won't get the strict-module) and I would like to confine myself to the perl-modules that are packaged for openwrt if possible and neither FCGI nor CGI::Fast are.

So my question is:

Is it possible to write a fast-cgi application in perl when all you have is the What would you need to adapt from a pure cgi-script?

Many thanks!

Replies are listed 'Best First'.
Re: fastcgi without the module
by Fletch (Bishop) on Dec 01, 2020 at 22:02 UTC

    FastCGI is (I believe; slightly rusty but going from memory) a C library implementing its API that lets a web server (e.g. mod_fcgi in apache) start up a persistent process which it will send requests to for handling. Theoretically one could write your own implementation of the API in perl (there's Net::FastCGI on CPAN, but I have no experience with it and since it looks that module hasn't been updated in 7 years . . .), but if your perl install is so stripped down (one might even say crippled) that it doesn't have strict you're probably not going to have a good time of it.

    What I'd try would be seeing if you can instal a more complete perl (a quick googling shows OpenWRT splits perl into an extremely strangely large number of subpackages so keep adding those) and the C FastCGI library and try installing the normal FCGI module from CPAN then.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I have strict, what I meant is that you need to install an extra package to get it. Everything is split into tiny packages and often the dependencies are not properly reflected.

      I may try to get cpan to work but probably I cannot really be bothered too much as for the little think I want to do cgi would be good enough...

        Aaah; I misunderstood / read that as you were trying to make do without all of the bits. In that case then Mojolicious and I'm sure the other frameworks like Dancer2 usually come with their own http server implementations (Plack mentioned above too) which will run your application (and to some degree also serve flat files) directly which would eliminate the need to run apache (or lighttpd or . . .) with fastcgi. That might be another route to look into.

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.

Re: fastcgi without the module
by Your Mother (Archbishop) on Dec 02, 2020 at 02:07 UTC

    From what I can see, and Iíve never dealt with openwrt, nginx is available as well as fastcgi and uwsgi plugins for it. IF that means you can build uwsgi with psgi, thatís what I would recommend over fastcgi. It will mean using either an app framework or naked psgi code (Plack). Nothing wrong with lighttpd, I just think nginx is better. uwsgi is a superior app engine in general. If youíre stuck with CGI or just want it for simplicity, this nginx version seems to support it, not all do.

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11124470]
Approved by Corion
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2023-03-21 16:54 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.