revert all changes since 0.5
[catagits/HTTP-Request-AsCGI.git] / examples / synopsis.pl
CommitLineData
3cdea3c7 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use CGI;
7use HTTP::Request;
8use HTTP::Request::AsCGI;
9
10my $request = HTTP::Request->new( GET => 'http://www.host.com/' );
11my $stdout;
12
13{
14 my $c = HTTP::Request::AsCGI->new($request)->setup;
15 my $q = CGI->new;
16
17 print $q->header,
18 $q->start_html('Hello World'),
19 $q->h1('Hello World'),
20 $q->end_html;
21
22 $stdout = $c->stdout;
23
b332ee65 24 # enviroment and descriptors will automatically be restored when $c is destructed.
3cdea3c7 25}
26
27while ( my $line = $stdout->getline ) {
28 print $line;
29}