I wrote this module and I also wrote one for Apache:Request but for some reason it's returning params us 'undef'. If someone could take a look and tell me if I have done anything wrong.
#!/usr/bin/perl -w
package iXML::Buffer::CGI;
use strict;
# use CGI ':standard';
use CGI;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {
'r' => new CGI,
'html' => undef,
'redir' => undef,
};
bless($self, $class);
return $self;
}
sub html {
my ($self, $html) = @_;
$self->{html} = $html;
}
sub redir {
my ($self, $redir) = @_;
$self->{redir} = $redir;
}
sub output {
my $self = shift;
if ($self->{redir}) {
$self->{r}->status(302);
# $self->{apr}->header_out('Location', $ENV{SCRIPT_NAME}.$self
+->{redir});
$self->{r}->header_out('Location', $self->{redir});
$self->{r}->header('text/html');
$self->{r}->print($self->{html});
}else{
$self->{r}->header('text/html');
$self->{r}->print($self->{html});
}
}
sub param {
my ($self) = shift;
my @in_params = $self->{r}->param;
my %out_params;
foreach my $p (@in_params){
%out_params = (
$p => $self->{r}->param($p),
);
}
return \%out_params;
}
1;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.