package WebGUI::Middleware::Snoop; use strict; use parent qw(Plack::Middleware); =head1 NAME WebGUI::Middleware::Snoop - sample middleware port of WebGUI::URL::Snoop =head1 DESCRIPTION This is PSGI middleware for WebGUI. It was ported from L, back when we still had URL handlers. L described itself as "A URL handler that should never be called." You might find this middleware useful as a template for creating other simple classes. =cut sub call { my $self = shift; my $env = shift; my $path = $env->{PATH_INFO}; if ($path =~ qr{^/abcdefghijklmnopqrstuvwxyz$}) { my $snoop = q|Snoopy
Why would you type in this URL? Really. What were you expecting to see here? You really need to get a life. Are you still here? Seriously, you need to go do something else. I think your boss is calling.
|; return [ 200, [ 'Content-Type' => 'text/html' ], [ $snoop ] ]; } else { return $self->app->($env); } } 1;