[Catalyst] CGI::Dump()
Ashley
apv at sedition.com
Fri Apr 18 20:22:20 BST 2008
On Apr 18, 2008, at 12:09 PM, Matt S Trout wrote:
> On Wed, Apr 16, 2008 at 06:59:14PM -0700, Ashley wrote:
>> Is there an established way to emulate this in Cat?
>>
>> CGI::Dump()
>>
>> I like it for dev work and simple one-off forms that are human
>> processed.
>
> <pre>[% USE Dumper; Dumper.Dump(c.req.params) | html; %]</pre>
>
Sure, sure. Sometimes I like to use it for email and such though for
simple stuff. I just nabbed the CGI code pretty directly. Not sure I
like it enough to put it somewhere permanent. In the end it's
probably almost as easy, and maybe better practice, to do it in a
template, email or not.
my($param,$value, at result);
return '' unless $c->req->param;
push(@result,"<ul>");
foreach $param ($c->req->param) {
my($name)=HTML::Entities::encode_entities($param);
push(@result,"<li><b>$param</b></li>");
push(@result,"<ul>");
foreach $value ($c->req->param($param)) {
$value = HTML::Entities::encode_entities($value);
$value =~ s/\n/<br\/>\n/g;
push(@result,"<li>$value</li>");
}
push(@result,"</ul>");
}
push(@result,"</ul>");
$body = join("\n", at result);
More information about the Catalyst
mailing list