bump to new dev release version
[catagits/HTTP-Request-AsCGI.git] / README
1 NAME
2     HTTP::Request::AsCGI - Setup a CGI enviroment from a HTTP::Request
3
4 VERSION
5     0.5_02
6
7 SYNOPSIS
8         use CGI;
9         use HTTP::Request;
10         use HTTP::Request::AsCGI;
11     
12         my $request = HTTP::Request->new( GET => 'http://www.host.com/' );
13         my $stdout;
14     
15         {
16             my $c = HTTP::Request::AsCGI->new($request)->setup;
17             my $q = CGI->new;
18         
19             print $q->header,
20                   $q->start_html('Hello World'),
21                   $q->h1('Hello World'),
22                   $q->end_html;
23         
24             $stdout = $c->stdout;
25         
26             # enviroment and descriptors will automatically be restored 
27             # when $c is destructed.
28         }
29     
30         while ( my $line = $stdout->getline ) {
31             print $line;
32         }
33     
34 DESCRIPTION
35     Provides a convinient way of setting up an CGI enviroment from a
36     HTTP::Request.
37
38 METHODS
39     new ( $request [, key => value ] )
40         Contructor, first argument must be a instance of HTTP::Request
41         followed by optional pairs of environment key and value.
42
43     enviroment
44         Returns a hashref containing the environment that will be used in
45         setup. Changing the hashref after setup has been called will have no
46         effect.
47
48     setup
49         Setups the environment and descriptors.
50
51     restore
52         Restores the enviroment and descriptors. Can only be called after
53         setup.
54
55     request
56         Returns the request given to constructor.
57
58     response
59         Returns a HTTP::Response. Can only be called after restore.
60
61     stdin
62         Accessor for handle that will be used for STDIN, must be a real
63         seekable handle with an file descriptor. Defaults to a tempoary
64         IO::File instance.
65
66     stdout
67         Accessor for handle that will be used for STDOUT, must be a real
68         seekable handle with an file descriptor. Defaults to a tempoary
69         IO::File instance.
70
71     stderr
72         Accessor for handle that will be used for STDERR, must be a real
73         seekable handle with an file descriptor.
74
75 SEE ALSO
76     examples directory in this distribution.
77     WWW::Mechanize::CGI
78     Test::WWW::Mechanize::CGI
79
80 THANKS TO
81     Thomas L. Shinnick for his valuable win32 testing.
82
83 AUTHOR
84     Christian Hansen, "ch@ngmedia.com"
85
86 LICENSE
87     This library is free software. You can redistribute it and/or modify it
88     under the same terms as perl itself.
89