CGI-Application-Plugin-Apache

 view release on metacpan or  search on metacpan

t/lib/ApachePlugin/CGI_compat.pm  view on Meta::CPAN

package ApachePlugin::CGI_compat;
use base 'CGI::Application';
use strict;
use warnings;
use CGI::Cookie;
use CGI::Application::Plugin::Apache qw(:all);

my $content = "<h1>HELLO THERE</h1>";

sub setup {
    my $self = shift;
    $self->start_mode('header');
    $self->run_modes([qw(
        query_obj
        cookie_set
        cookie_get
        dump
        vars
        escape
        delete
        delete_all
        upload
    )]);
}

sub query_obj {
    my $self = shift;
    return $content
        . "<h3>Im in runmode query_obj</h3>"
        . "obj is " . ref($self->query);
}

sub cookie_set {
    my $self = shift;
    $self->header_type('header');
    my $cookie = $self->query->cookie(
        -name    => 'cgi_cookie',
        -value   => 'yum',
    );
    $self->header_add(
        -cookie => $cookie,
    );
    return $content
        . "<h3>Im in runmode cookie_set</h3>";
}

sub cookie_get {
    my $self = shift;
    my $value = $self->query->cookie('cgi_cookie');
    return $content
        . "<h3>Im in runmode cookie_get</h3>"
        . "cookie value = '$value'";
}

sub dump {
    my $self = shift;
    return $content
        . "<h3>Im in runmode dump</h3>"
        . $self->query->Dump();
}

sub vars {
    my $self = shift;
    my %vars = $self->query->Vars();
    my $var_string = '';



( run in 0.711 second using v1.01-cache-2.11-cpan-39bf76dae61 )