Plack::Handler::CLI

Command line interface to PSGI applications
Download

Plack::Handler::CLI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Goro Fuji
  • Publisher web site:
  • http://search.cpan.org/~gfuji/

Plack::Handler::CLI Tags


Plack::Handler::CLI Description

Command line interface to PSGI applications Plack::Handler::CLI is a PSGI handler which provides a command line interface for PSGI applications.SYNOPSIS #!perl -w # a cat(1) implementation on PSGI/CLI use strict; use Plack::Handler::CLI; use URI::Escape qw(uri_unescape); sub err { my(@msg) = @_; return , \@msg, ]; } sub main { my($env) = @_; my @files = split '/', $env->{PATH_INFO}; local $/; my @contents; if(@files) { foreach my $file(@files) { my $f = uri_unescape($file); open my $fh, '< ', $f or return err("Cannot open '$f': $!\n"); push @contents, readline($fh); } } else { push @contents, readline($env->{'psgi.input'}); } return , \@contents, ]; } my $handler = Plack::Handler::CLI->new(need_headers => 0); $handler->run(\&main); Requirements: · Perl


Plack::Handler::CLI Related Software