#!/usr/bin/perl -- use strict; use warnings; use Plack::Builder; use Path::Tiny qw/ path /; my $app = sub { return [ 200, [ 'Content-Type' => 'text/plain; charset=UTF-8', ], path( __FILE__ )->openr_raw, ]; }; my $finalapp = builder { enable 'StackTrace'; $app; }; if( $0 eq __FILE__ ){ require Plack::Runner; my $runner = Plack::Runner->new; $runner->parse_options( qw' --host 127.0.0.1 --port 5000 ' ); $runner->run( $finalapp ); ## perl this.psgi } else { $finalapp; ## plackup -l localhost:5000 this.psgi } ## lwp-request -Ed http://127.0.0.1:5000/