Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Yappo (7398)

Yappo
  (email not shown publicly)
http://blog.yappo.jp/

Journal of Yappo (7398)

Wednesday November 01, 2006
08:09 AM

Soozy test code

[ #31471 ]

use strict;
use warnings;
use lib 'lib';

BEGIN {
    $ENV{JITENSYA_ROOT}  = '/home/soozy/jitensya';
    $ENV{JITENSYA_DEBUG} = 1;
    $ENV{JITENSYA_MODE}  = 'dev';

    require Jitensya;
}

local_request('/app/');

sub local_request {

    require HTTP::Request::AsCGI;

    my $request = request( shift(@_) );
    my $cgi     = HTTP::Request::AsCGI->new( $request, %ENV )->setup;

    Jitensya->handle_request;

    return $cgi->restore->response;
}

sub request {
    my $request = shift;

    require HTTP::Request;

    unless ( ref $request ) {
        if ( $request =~ m/^http/i ) {
            $request = URI->new($request)->canonical;
        }
        else {
            $request = URI->new( 'http://localhost' . $request )->canonical;
        }
    }
    unless ( ref $request eq 'HTTP::Request' ) {
        $request = HTTP::Request->new( 'GET', $request );
    }
    return $request;
}

Catalyst inspired

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.