OpenPlugin::HttpHeader::CGI - CGI Driver for the OpenPlugin::HttpHeader plugin


OpenPlugin documentation Contained in the OpenPlugin distribution.

Index


Code Index:

NAME

Top

OpenPlugin::HttpHeader::CGI - CGI Driver for the OpenPlugin::HttpHeader plugin

PARAMETERS

Top

This plugin is a child of the Request plugin. Without the Request plugin, this one cannot function properly. That being the case, you won't actually pass in parameters to this plugin, but to the request plugin. See the Request plugin for more information.

CONFIG OPTIONS

Top

* driver

CGI

As this is a child plugin of the Request plugin, the configuration of this plugin should be embedded within the configuration for the Request plugin. Additionally, if you wish to use this driver for this plugin, then you must also enable this driver under the Request plugin.

METHODS

Top

BUGS

Top

None known.

TO DO

Top

Nothing known.

SEE ALSO

Top

COPYRIGHT

Top

AUTHORS

Top

Eric Andreychek <eric@openthought.net>


OpenPlugin documentation Contained in the OpenPlugin distribution.

package OpenPlugin::HttpHeader::CGI;

# $Id: CGI.pm,v 1.24 2003/04/03 01:51:25 andreychek Exp $

use strict;
use OpenPlugin::HttpHeader();
use base   qw( OpenPlugin::HttpHeader );
use CGI( -no_debug );

$OpenPlugin::Params::CGI::VERSION = sprintf("%d.%02d", q$Revision: 1.24 $ =~ /(\d+)\.(\d+)/);

sub init {
    my ( $self, $args ) = @_;

    return $self unless $self->OP->request->object;

    my @headers;

    { # The HTTP sub in CGI.pm can produce some odd looking warnings
        local $^W = 0;
        @headers = $self->OP->request->object->http();
    }
    # Tell OpenPlugin about each header we were sent
    foreach my $header ( @headers ){
        $self->set_incoming( $header,
                $self->OP->request->object->http( $header ));
    }

    return $self;
}

*send = \*send_outgoing;

sub send_outgoing {
    my ( $self, $type ) = @_;

    $type ||= "text/html";
    $self->set_outgoing( "-content_type", $type );

    print $self->OP->request->object->header( $self->get_outgoing );

    # If the cookie plugin is loaded, check to see if we need to send any
    # cookies along with the header
    $self->OP->cookie->bake if
                    grep "OpenPlugin::Cookie", $self->OP->loaded_plugins;


    return undef;
}

1;

__END__