File Coverage

blib/lib/OpenPlugin/HttpHeader/CGI.pm
Criterion Covered Total %
statement 20 27 74.0
branch 1 4 25.0
condition 0 2 0.0
subroutine 5 6 83.3
pod 0 2 0.0
total 26 41 63.4


line stmt bran cond sub pod time code
1             package OpenPlugin::HttpHeader::CGI;
2              
3             # $Id: CGI.pm,v 1.24 2003/04/03 01:51:25 andreychek Exp $
4              
5 2     2   2359 use strict;
  2         4  
  2         14215  
6 2     2   1462 use OpenPlugin::HttpHeader();
  2         5  
  2         51  
7 2     2   14 use base qw( OpenPlugin::HttpHeader );
  2         4  
  2         490  
8 2     2   23 use CGI( -no_debug );
  2         5  
  2         19  
9              
10             $OpenPlugin::Params::CGI::VERSION = sprintf("%d.%02d", q$Revision: 1.24 $ =~ /(\d+)\.(\d+)/);
11              
12             sub init {
13 2     2 0 7 my ( $self, $args ) = @_;
14              
15 2 50       8 return $self unless $self->OP->request->object;
16              
17 2         5 my @headers;
18              
19             { # The HTTP sub in CGI.pm can produce some odd looking warnings
20 2         3 local $^W = 0;
  2         10  
21 2         9 @headers = $self->OP->request->object->http();
22             }
23             # Tell OpenPlugin about each header we were sent
24 2         149 foreach my $header ( @headers ){
25 0         0 $self->set_incoming( $header,
26             $self->OP->request->object->http( $header ));
27             }
28              
29 2         11 return $self;
30             }
31              
32             *send = \*send_outgoing;
33              
34             sub send_outgoing {
35 0     0 0   my ( $self, $type ) = @_;
36              
37 0   0       $type ||= "text/html";
38 0           $self->set_outgoing( "-content_type", $type );
39              
40 0           print $self->OP->request->object->header( $self->get_outgoing );
41              
42             # If the cookie plugin is loaded, check to see if we need to send any
43             # cookies along with the header
44 0 0         $self->OP->cookie->bake if
45             grep "OpenPlugin::Cookie", $self->OP->loaded_plugins;
46              
47              
48 0           return undef;
49             }
50              
51             1;
52              
53             __END__