perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luiz Fernando B. Ribeiro" <l...@engenhosolucoes.com.br>
Subject Re: Newbie issue
Date Fri, 10 Sep 2004 01:38:11 GMT
Hi,

Your setup is almost good except for CGI.pm, you don't need it with Embperl.

In your done.html output plain html outside a [--] block and use Embperl 
syntax for code and loops, take a look at the manual pages.

If you really need to output inside a [- block, but it is not the case 
in your example, you have to use print OUT "anything";. OUT is an 
especial Filehandle connected to the output stream.

Good luck,

-- 
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet
+55 11 4485-0136

Keven Murphy wrote:
> I cannot figure out why the below html source page is hosed up. Why is
> embperl not putting the body (the frist part, the forms) between the
> <body> </body> lines. My code is below:
> 
> ------- Page Source from web browser --------------------
> <form method="post"
> action="/term_done/done.html" enctype="application/x-www-form-urlencoded">
> <H1>Systems Check</H1><input type="submit" name=".submit" /><TABLE
> WIDTH="50%"><TR><TH ALIGN="CENTER">Select</TH><TH ALIGN="LEFT">ID</TH><TH
> ALIGN="LEFT">Report Name</TH><TH ALIGN="LEFT">Loc</TH><TH
> ALIGN="LEFT">Date and Time</TH><TR><TD ALIGN="CENTER"><INPUT
TYPE="radio"
> NAME="repid" VALUE="3"></TD><TD ALIGN="LEFT">3</TD><TD
> ALIGN="LEFT">Today</TD><TD ALIGN="LEFT">/dev/null</TD><TD
> ALIGN="LEFT">2004-08-29 17:08:44</TD></TR><TR><TD ALIGN="CENTER"><INPUT
> TYPE="radio" NAME="repid" VALUE="2"></TD><TD ALIGN="LEFT">2</TD><TD
> ALIGN="LEFT">Today</TD><TD ALIGN="LEFT">/dev/null</TD><TD
> ALIGN="LEFT">2004-08-29
> 17:07:54</TD></TR></TABLE><div></div></form>HTTP/1.1
200 OK
> Date: Thu, 09 Sep 2004 22:05:55 GMT
> Server: Apache/1.3.31 (Unix) mod_perl/1.28
> Content-Length: 99
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Content-Type: text/html
> 
> 
> <HTML>
> <head>
> </head>
> <body>
> 
> Currently logged in as: murphyk<P>
> 
> <HR>
> 
> <hr>
> <hr>
> </body>
> </html>
> 
> ------------------------------------------
> 
> base.epl
> <HTML>
> [- Execute ('constants.epl')-]
> [- Execute ('init.epl')-]
> <HEAD>
> [- Execute ('head.epl')-]
> </HEAD>
> <BODY>
> [- Execute ('*') -]
> </BODY>
> [- Execute ('cleanup.epl') -]
> </HTML>
> 
> constants.epl
> [-
>   $req = shift;
>   $req->{bgcolor} = "white";
>   $req->{webmaster} = "John Smith";
>   $req->{website_database} = "db";
>   $req->{DBHOST} = "localhost";
>   $req->{DBNAME} = "db";
>   $req->{DBUSER} = "mysql";
>   $req->{DBPASS} = "aaaa";
> -]
> 
> init.epl
> [-
> use DBI;
> 
> $req->{dbh} =
> DBI->connect("DBI:mysql:database=$req->{DBNAME};host=localhost",$req->{DBUSER},
> $req->{DBPASS}) || die "Connect failed: $DBI::errstr\n";
> -]
> 
> head.epl
> <TITLE> DB </TITLE>
> 
> 
> html file (done.html)
> [-
> $req = shift;
> 
> my $done = CGI->new();
> -]
> 
> Currently logged in as: [+$udat{userid}+]<P>
> 
> [-
> $req->{query} = $req->{dbh}->prepare($qry) or die "Cound not Execute:
> $DB::errstr";
> $req->{query}->execute();
> 
> 
> 
> print start_form;
> #print "<HR>";
> 
> print "<H1>Systems Check</H1>";
> print submit;
> 
> 
> 
> print "<TABLE WIDTH=\"50%\">";
> print "<TR>";
> print "<TH ALIGN=\"CENTER\">Select<\/TH>";
> print "<TH ALIGN=\"LEFT\">ID<\/TH>";
> print "<TH ALIGN=\"LEFT\">Report Name<\/TH>";
> print "<TH ALIGN=\"LEFT\">Loc<\/TH>";
> print "<TH ALIGN=\"LEFT\">Date and Time<\/TH>";
> 
> while ( @rows = $req->{query}->fetchrow) {
>     print "<TR>";
>     print "<TD ALIGN=\"CENTER\"><INPUT TYPE=\"radio\" NAME=\"repid\"
> VALUE=\"$rows[0]\"><\/TD>";
>     for ($num = 0; $num < 4; $num++) {
>        print "<TD ALIGN=\"LEFT\">$rows[$num]<\/TD>";
>     }
>     print "<\/TR>";
> }
> print "<\/TABLE>";
> 
> print end_form;
> -]
> 
> cleanup.epl
> [-
> $req = shift;
> $req->{dbh}->disconnect();
> -]
> 
> Any help would be much appreciated!
> 
> Keven Murphy
> CISSP, GCIA, GCIH, GCFA
> murphyk@gdls.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message