-
-
30 Nov 2020 00:21:36 UTC
- Distribution: Plack
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (98)
- Testers (4441 / 10 / 0)
- Kwalitee
Bus factor: 1- 80.40% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity
24 month- Tools
- Download (185.98KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 131 contributors- Tatsuhiko Miyagawa
-
Aaron Trevena
-
Ævar Arnfjörð Bjarmason
-
Akzhan Abdulin
-
Alexandr Ciornii
-
Alex J. G. Burzyński
-
Allan Whiteford
-
Andrew Fresh
-
Andrew Rodland
-
Andy Wardley
-
Aristotle Pagaltzis
-
Arthur Axel 'fREW' Schmidt
-
Asato Wakisaka
-
Ashley Pond V
-
Ask Bjørn Hansen
-
ben hengst
-
Ben Morrow
-
Bernhard Graf
-
Chad Granum
-
chansen
-
Chia-liang Kao
-
cho45
-
Christian Walde
-
chromatic
-
Cosimo Streppone
-
Dagfinn Ilmari Mannsåker
-
Daisuke Maki
-
Daisuke Murase
-
Dave Marr
-
Dave Rolsky
-
David E. Wheeler
-
David Schmidt
-
David Steinbrunner
-
dmaestro
-
Eduardo Arino de la Rubia
-
Emmanuel Seyman
-
Eric Johnson
-
Eugen Konkov
-
Fabrice Gabolde
-
fayland
-
Flavio Poletti
-
Florian Ragwitz
-
franck cuny
-
Gianni Ceccarelli
-
Graham Knop
-
Grant McLean
-
Hans Dieter Pearcey
-
Haruka Iwao
-
Henry Baragar
-
hiratara
-
HIROSE Masaaki
-
Hiroshi Sakai
-
Ian Bradley
-
Ian Burrell
-
Jakob Voss
-
Jay Hannah
-
Jesse Luehrs
-
Jiro Nishiguchi
-
Johannes Plunien
-
John Beppu
-
John Napiorkowski
-
Jonathan Swartz
-
José Pinheiro Neta
-
Justin Davis
-
kakuno
-
Kang-min Liu
-
Karen Etheridge
-
Kazuho Oku
-
Keedi Kim
-
Lee Aylward
-
Leo Lapworth
-
mala
-
Marco Pessotto
-
Marian Schubert
-
Mark Fowler
-
Mark Stosberg
-
Masahiro Chiba
-
Masahiro Nagano
-
Michael G. Schwern
-
Michal Josef Špaček
-
mickey
-
Narsimham Chelluri
-
Nick Wellnhofer
-
Nobuo Danjou
-
Olaf Alders
-
Oliver Gorwits
-
Oliver Paukstadt
-
Oliver Trosien
-
Olivier Mengué
-
osfameron
-
Panu Ervamaa
-
Paul Driver
-
Pedro Melo
-
Perlover
-
Peter Flanigan
-
Peter Makholm
-
Piotr Roszatycki
-
punytan
-
Rafael Kitover
-
Randy Stauner
-
Ray Miller
-
Richard Simões
-
Ricky Morse
-
Robert Rothenberg
-
Rob Hoelz
-
runarb
-
Ryo Miyake
-
Sawyer X
-
Scott S. McCoy
-
Shawn M Moore
-
Shoichi Kaji
-
smcmurray
-
Stephen Clouse
-
Stevan Little
-
Stuart A Johnston
-
Takeshi OKURA
-
The Dumb Terminal
-
Thomas Klausner
-
Thomas Sibley
-
Tim Bunce
-
Tokuhiro Matsuno
-
Tomas Doran
-
Tom Heady
-
vti
-
Wallace Reis
-
xaicron
-
Yann Kerherve
-
yappo
-
Yury Zavarin
-
Yuval Kogman
-
唐鳳
- Dependencies
- Apache::LogFormat::Compiler
- Cookie::Baker
- Devel::StackTrace
- Devel::StackTrace::AsHTML
- File::ShareDir
- Filesys::Notify::Simple
- HTTP::Entity::Parser
- HTTP::Headers::Fast
- HTTP::Message
- HTTP::Tiny
- Hash::MultiValue
- Pod::Usage
- Stream::Buffered
- Test::TCP
- Try::Tiny
- URI
- WWW::Form::UrlEncoded
- parent
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Plack::App::CGIBin - cgi-bin replacement for Plack servers
SYNOPSIS
use Plack::App::CGIBin; use Plack::Builder; my $app = Plack::App::CGIBin->new(root => "/path/to/cgi-bin")->to_app; builder { mount "/cgi-bin" => $app; }; # Or from the command line plackup -MPlack::App::CGIBin -e 'Plack::App::CGIBin->new(root => "/path/to/cgi-bin")->to_app'
DESCRIPTION
Plack::App::CGIBin allows you to load CGI scripts from a directory and convert them into a PSGI application.
This would give you the extreme easiness when you have bunch of old CGI scripts that is loaded using cgi-bin of Apache web server.
HOW IT WORKS
This application checks if a given file path is a perl script and if so, uses CGI::Compile to compile a CGI script into a sub (like ModPerl::Registry) and then run it as a persistent application using CGI::Emulate::PSGI.
If the given file is not a perl script, it executes the script just like a normal CGI script with fork & exec. This is like a normal web server mode and no performance benefit is achieved.
The default mechanism to determine if a given file is a Perl script is as follows:
Check if the filename ends with
.pl
. If yes, it is a Perl script.Open the file and see if the shebang (first line of the file) contains the word
perl
(like#!/usr/bin/perl
). If yes, it is a Perl script.
You can customize this behavior by passing
exec_cb
callback, which takes a file path to its first argument.For example, if your perl-based CGI script uses lots of global variables and such and are not ready to run on a persistent environment, you can do:
my $app = Plack::App::CGIBin->new( root => "/path/to/cgi-bin", exec_cb => sub { 1 }, )->to_app;
to always force the execute option for any files.
AUTHOR
Tatsuhiko Miyagawa
SEE ALSO
Plack::App::File CGI::Emulate::PSGI CGI::Compile Plack::App::WrapCGI
See also Plack::App::WrapCGI if you compile one CGI script into a PSGI application without serving CGI scripts from a directory, to remove overhead of filesystem lookups, etc.
Module Install Instructions
To install Plack, copy and paste the appropriate command in to your terminal.
cpanm Plack
perl -MCPAN -e shell install Plack
For more information on module installation, please visit the detailed CPAN module installation guide.