Revision: 66707
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 23, 2014 00:18 by dbiesecke
Initial Code
#!/usr/bin/perl -- #~ plack-debug-mounted.pl #~ 2013-10-17-02:59:26 #~ ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use CGI(); use Data::Dump qw/ dd pp /; use Path::Tiny qw/ path /; use Plack::Builder; use Plack::Runner; my $selfsourceapp = sub { return [ '200', [ 'Content-Type' => 'text/plain', ], [ path( __FILE__ )->slurp_raw ], ]; }; my $dumperapp = sub { my $q = CGI->new( $_[0] ); return [ '200', [ 'Content-Type' => 'text/html', 'Content-Length' => '2', ], [ $q->start_html( -title => 'dumpenv.psgi' ), $q->h1( $_[0]->{SCRIPT_NAME} ), $q->Dump, $q->end_html, ], ]; }; my $indexapp = sub { return [ '200', [ 'Content-Type' => 'text/html', ], [ q{<doctype html> <html lang="en-US" charset="UTF-8"> <title> Plack perlology </title> <body> <p> A Plack::Middleware::Debug free zone <br> <a href="/"> this </a> <br> <a href="/dumpenv"> dupenv </a> <br> <a href="/selfsrc"> selfsrc </a> <p> Get <c>Plack::Middleware::Debug</c> <b> ed </b> <br> <a href="/debugged/"> /debugged/ this </a> <br> <a href="/debugged/dumpenv"> /debugged/dupenv </a> <br> <a href="/debugged/selfsrc"> /debugged/selfsrc </a> <p> Come get some <br> <a href="/debugged/debug_toolbar/toolbar.min.css"> /debugged/debug_toolbar/toolbar.min.css </a> <br> <a href="/debugged/debug_toolbar/toolbar.min.js"> /debugged/debug_toolbar/toolbar.min.js </a> <p> Cant get this <br> <a href="/debug_toolbar/toolbar.min.css"> /debug_toolbar/toolbar.min.css </a> <br> <a href="/toolbar.min.css"> /toolbar.min.css </a> </body><!-- before this Plack::Middleware::Debug inserts, viewsource!! --> } ], ]; }; my $finalapp = builder { mount '/debugged' => builder { enable 'Debug', panels => [ qw/ Timer Response Environment Session Parameters / ]; mount "/dumpenv" => $dumperapp; mount "/selfsrc" => $selfsourceapp; mount "/" => $indexapp; }; mount "/dumpenv" => $dumperapp; mount "/selfsrc" => $selfsourceapp; mount "/" => $indexapp; }; my $runner = Plack::Runner->new; $runner->parse_options( qw' --host 127.0.0.1 --port 80 ' ); $runner->run( $finalapp );
Initial URL
https://stackoverflow.com/questions/19178044/using-plack-app-with-a-reverse-proxy-plackmiddlewaredebug?answertab=active#tab-top
Initial Description
Maps multiple apps with mount and URLMap
Initial Title
Plack maps multiple pages
Initial Tags
perl
Initial Language
Perl