Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I'm not sure i understand your param() method - what is it's purpose? Wouldn't it be easier and more effective to just use something like:
sub param { my ($self,$param) = @_; return $self->{'r'}->param($param); }
With your code, what happens if i send a query string like foo.cgi?foo=bar&foo=baz&foo=qux?

Style issues:
Remember that => automagically quotes the left hand side:

my $self = { r => CGI->new(), html => undef, redir => undef, };
Also note that i used the direct notation to instantiate the CGI object, this is not at all necessary, but it is a good habit to get into.

In output(), since you are refering to $self->{r} multiple times, i recommend assigning it to a scalar:

sub output { my $self = shift; if ($self->{'redir'}) { my $r = $self->{'r'}; $r->status(302); # etc ... } }

Other than that it looks good - try mortis's suggestion, then test it with a query string that contains multilples values for one variable. Make sure you get an array back, otherwise you might want to just write a wrapper for the param method like i did. But, again, what is the purpose of this module, why would i want to use it instead of CGI.pm?

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)

In reply to (jeffa) Re: CGI Buffer module will not return params. by jeffa
in thread CGI Buffer module will not return params. by IOrdy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found