Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: no webserver(apache)? no problem! test .cgi with Plack/plackup

by Your Mother (Bishop)
on Apr 04, 2011 at 17:29 UTC ( #897369=note: print w/replies, xml ) Need Help??

in reply to no webserver(apache)? no problem! test .cgi with Plack/plackup

++ I'm commenting mostly just to bump this excellent piece of advice.

Since port is rarely important and I like to use this idiom in addition to running a traditional webserver on port 80, I'd shorten it to use the default port 5000–

plackup -L Shotgun -MPlack::App::WrapCGI -e "Plack::App::WrapCGI->new(script => shift)" [cgi]

–which lends itself to an alias–

alias pcgi='plackup -Ilib -L Shotgun -MPlack::App::WrapCGI -e "Plack:: +App::WrapCGI->new(script => shift)"'

Update: anonymous monk that replied is quite correct. The code, as is, is broken.

Update: And a million years later... alias works in bash, at least.

alias pcgi='plackup -L Shotgun -MPlack::App::WrapCGI -e "Plack::App::W +rapCGI->new(script => \$ARGV[0])"' pcgi some.cgi HTTP::Server::PSGI: Accepting connections at http://0:5000/ ...

Replies are listed 'Best First'.
Re^2: no webserver(apache)? no problem! test .cgi with Plack/plackup
by Anonymous Monk on Apr 22, 2011 at 04:08 UTC
    FWIW, that doesn't work for me
    Magic number checking on storable string failed at blib\lib\Storable.p +m (autosplit into blib\lib\auto\Storable\ line 421, at c:/per +l/site/5.12.2/lib/Plack/Loader/ line 25
    $ pmvers Plack Storable Plack: 0.9976 Storable: 2.25
    It has to do with string-eval and @ARGV being emptied

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://897369]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2018-05-25 13:33 GMT
Find Nodes?
    Voting Booth?