Home  |  Linux  | Mysql  | PHP  | XML
From:Gurunandan R. Bhat Date:Tue Jun 30 03:26:01 2009
Subject:Re: Rendering data structures using CGI::Application
How do you want the output to look? If you write in a sample output, I
could help with the template to generate that output

Regards


On Mon, 2009-06-29 at 22:56 -0400, Steve Bertrand wrote:

> I've been stuck for the last three hours trying to render the following
> data structure into my browser. I'm using CGI::Application, and
> CGI::Application::Plugin::PageBuilder.
>
> No matter what I do or try, I can not loop the structure into a template
> variable. I'm literally at wits end, and am considering just figuring
> out a way to 'print' it out.
>
> Any strong kick to the teeth as a boost would be most appreciated. This
> is my data structure, and below shows that the particular module that
> produces this data can be queried to produce more human readable output:
>
> $error->dump_all();
>
> $VAR1 = \[
> 'quantity is undefined, zero or illegal',
> 'amount is undefined or illegal',
> 'payment is undefined or illegal'
> ];
> $VAR2 = \[
> {
> 'sub' => undef,
> 'filename' => 'tests/purchase.pl',
> 'line' => 43,
> 'package' => 'main'
> },
> {
> 'sub' => 'ISP::Transac::create_transaction',
> 'filename' => '../ISP/Transac.pm',
> 'line' => 32,
> 'package' => 'ISP::Transac'
> },
> {
> 'sub' => 'ISP::Sanity::transaction_data',
> 'filename' => '../ISP/Sanity.pm',
> 'line' => 55,
> 'package' => 'ISP::Sanity'
> }
> ];
>
> # I can print it out nicely on the command line, but not in the browser:
>
> my @messages = $error->get_messages();
> my @stack = $error->get_stack();
>
> print join ("\n", @messages);
>
> for (@stack) {
> while ( my ($key, $value) = each %{$_}) {
> print "$key => $value\n"
> if defined $key and
> defined $value;
> }
> }
> }
>
> Is there an easy way to render this to the browser, while keeping HTML
> out of my code?
>
> Steve

Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
AW: AW: friend class in perl
Re: Traversing Hash printing two times
Re: Need help with Mail::Sender
Re: More compact way to write this
Re: Traversing Hash printing two times



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants