removed examples/mechanize.pl
Christian Hansen [Fri, 28 Oct 2005 13:12:48 +0000 (13:12 +0000)]
MANIFEST
examples/mechanize.pl [deleted file]

index 097e2fe..68b1f0d 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,5 @@
 Changes
 examples/daemon.pl
-examples/mechanize.pl
 examples/synopsis.pl
 lib/HTTP/Request/AsCGI.pm
 Makefile.PL
diff --git a/examples/mechanize.pl b/examples/mechanize.pl
deleted file mode 100644 (file)
index 774ace3..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/perl
-
-package Test::WWW::Mechanize::CGI;
-
-use strict;
-use warnings;
-use base 'Test::WWW::Mechanize';
-
-use HTTP::Request;
-use HTTP::Request::AsCGI;
-use HTTP::Response;
-
-sub cgi {
-    my $self = shift;
-
-    if ( @_ ) {
-        $self->{cgi} = shift;
-    }
-
-    return $self->{cgi};
-}
-
-sub env {
-    my $self = shift;
-
-    if ( @_ ) {
-        $self->{env} = { @_ };
-    }
-
-    return %{ $self->{env} || {} };
-}
-
-sub _make_request {
-    my ( $self, $request ) = @_;
-
-    if ( $self->cookie_jar ) {
-        $self->cookie_jar->add_cookie_header($request);
-    }
-
-    my %e = $self->env;
-    my $c = HTTP::Request::AsCGI->new( $request, %e )->setup;
-
-    eval { $self->cgi->() };
-
-    my $response;
-
-    if ( $@ ) {
-        $response = HTTP::Response->new(500);
-        $response->date( time() );
-        $response->header( 'X-Error' => $@ );
-        $response->content( $response->error_as_HTML );
-        $response->content_type('text/html');
-    }
-    else {
-        $response = $c->restore->response;
-    }
-
-    $response->header( 'Content-Base', $request->uri );
-    $response->request($request);
-
-    if ( $self->cookie_jar ) {
-        $self->cookie_jar->extract_cookies($response);
-    }
-
-    return $response;
-}
-
-package main;
-
-use strict;
-use warnings;
-
-use CGI;
-use Test::More tests => 3;
-
-my $mech = Test::WWW::Mechanize::CGI->new;
-$mech->cgi( sub {
-
-    my $q = CGI->new;
-
-    print $q->header,
-          $q->start_html('Hello World'),
-          $q->h1('Hello World'),
-          $q->end_html;
-});
-
-$mech->get_ok('http://localhost/');
-$mech->title_is('Hello World');
-$mech->content_contains('Hello World');