#!/bin/sh

exec 3<&0

$PERL -x <<'END_OF_SCRIPT'
#!perl

use CGI 'cookie';
use CGI::ExtDirect;

use RPC::ExtDirect::Test::Pkg::Foo;
use RPC::ExtDirect::Test::Pkg::JuiceBar;
use RPC::ExtDirect::Test::Pkg::Qux;

open STDIN, '<&3' or die "Can't reopen STDIN";

# Set the cheat flag for file uploads
local $RPC::ExtDirect::Test::Pkg::JuiceBar::CHEAT = 1;

my $cookie = cookie(-name=>'sessionID',
                    -value=>'xyzzy',
                    -expires=>'Thursday, 25-Apr-1999 00:40:33 GMT',
                    -path=>'/cgi-bin/database',
                    -domain=>'.capricorn.org',
                    -secure=>1);

my %headers = (
    '-Status'           => '204 No Response',
    '-Content-type'     => 'text/plain',
    '-ChArSeT'          => 'iso-8859-1',
    '-Content_Length'   => '123123',
    '-cookie'           => $cookie,
);

my $cgi = CGI::ExtDirect->new({ debug => 1 });

print $cgi->route( %headers );

exit 0;
