develooper Front page | perl.beginners | Postings from April 2002

Re: no output from the script

Thread Previous | Thread Next
From:
drieux
Date:
April 1, 2002 09:38
Subject:
Re: no output from the script
Message ID:
25137DA0-4597-11D6-ADD2-0030654D3CAE@wetware.com

On Monday, April 1, 2002, at 08:15 , Joe Echavarria wrote:

that he was having problem with the cgi script -

amongst other things there is no 'start_html' in it
to make sure that it is set up correctly.

I would propose something on the order of the script at
the end, where I would isolate the two open and read calls.
Since I of course do not have the 'data' - this also allows
me to stub those functions out.

Ok, so I am also a Freak about calling 'print once'. so I
have this compulsion about setting up the page.....

this of course does not take into account the 'so what if
I am called when there is a POST' ...

### #!/usr/bin/perl -w
###
### use strict;
### use CGI qw/:standard/;
###
### sub get_lists { my @list =  qw/ dog:pedro cat:alice foo:bar/ ; @list; 
}
###
### sub get_catagoria { my @list = qw/ dog:doggie cat:catneff foo:fooNaff/
;
###     @list;
### }
###
### sub get_firstPage {
###
###     my $page = start_html('- LISTA DE LINKS -');
###     $page .= "<B>Lista de Categorias </B><BR><BR>";
###
###     $page .= start_form; #take the defaults
###
###     $page .= '<select name="categorias" size="1">';
###     my @categorias = get_catagoria;
###
###     while ( my $file1 = pop(@categorias) ) {
###         my ($no,$desc)=split(":",$file1);
###         $page .= "<option value=\"$no\">$no</option>";
###     }
###
###     $page .= "</select><Input type=\"submit\" value=\"GO\">";
###
###      $page .=  end_form;
###     $page ;
###
### } # end get_firstPage
###
### sub append_table {
###
###     my ($page) = @_;
###
###     my @lista = get_lists ;
###
###     my @TableRow = ();
###
###     while ( my $file = pop(@lista) ) {
###         my ($categoria,$link) = split(":",$file);
###         push( @TableRow , td([$categoria,$link]));
###     }
###     $page .= table( {border=>5, cellpadding=>5},
###         caption("LISTA DE LINKS"),
###
###         TR( [
###             th(['TEMA', 'LINK']),
###             @TableRow
###         ]));
###
###     $page ;
###
### } # end append_table
###
### sub send_page {
###
###     my ($page) = @_;
###     $page .= end_html;
###
###     print header, $page ;
###
### } #end send_page
###
### #---------------------
### #
###
### my $theHtmlPage = get_firstPage;
###
### $theHtmlPage= append_table($theHtmlPage);
###
### send_page($theHtmlPage);
###
###




ciao
drieux

---


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About