1. CGI program only recognizes the "puts(1,"....\n") instr
The following is the start of a CGI script...
It works fine 'until'...the very first 'non-'puts(1,"..\n")'
is introduced. The two commented lines at the beginning will
cause failure if uncommented..... no matter where they are placed.
What's the secret to using the rest of the instruction set in a CGI ??
#!c:\Euphoria\Bin\exw.exe
-- build html page:
-- integer fn
-- sequence line
puts(1,"Content-type: text/HTML\n\n") -- most important!
puts(1,"<html><head>\n")
puts(1,"<title>Blues Remits Splitter</title>\n")
puts(1,"<body text=blue>\n")
puts(1,"<center>\n")
puts(1,"<H1>Blues Remittances for 7/28/04</H1>\n")
puts(1,"<TABLE BORDER=1 BGCOLOR=pink>\n")
puts(1,"<tr><td colspan=30>Received Date</td>\n")
puts(1,"<td>Provider</td>\n")
puts(1,"<td>Svc Year</td>\n")
puts(1,"<td>Account #</td>\n")
puts(1,"<td>Last Name</td>\n")
puts(1,"<td>First Name</td>\n")
puts(1,"<td>Mid Init</td>\n")
puts(1,"<td>Sub Last Name</td>\n")
puts(1,"<td>Sub First Name</td>\n")
puts(1,"<td>Sub Mid Init</td>\n")
puts(1,"<td>Date of Birth</td>\n")
puts(1,"<td>HIC Number</td>\n")
puts(1,"</tr></table>\n")
2. Re: CGI program only recognizes the "puts(1,"....\n") instr
what's happening here, is exw is trying to report an warning saying that
those variables have not been assigned a value. the problem is that your
server (Apache?) won't allow the program to display any output to the
screen, so it crashes. writing CGI in Euphoria is very difficult at first,
since any error output to the screen causes the script to crash. try running
your script on its own ("exw my_script_name.exw") first and see if you have
any errors. if you can output only HTML and have no errors, then your script
should run fine. to prevent unassigned variables from triggering warnings,
use 'without warning' at the top of your script.
another tip - if you're going to use include files in your scripts, you have
to place them in the same directory as the main file, OR include them as the
full path name
here's the fix:
#!c:\Euphoria\Bin\exw.exe
without warning
-- build html page:
integer fn
sequence line
puts(1,"Content-type: text/HTML\n\n") -- most important!
puts(1,"<html><head>\n")
----- Original Message -----
From: "John F Dutcher" <guest at RapidEuphoria.com>
To: <EUforum at topica.com>
Sent: Monday, August 02, 2004 3:42 PM
Subject: CGI program only recognizes the "puts(1,"....\n") instr
> ============ The Euphoria Mailing List ============
>
>
> posted by: John F Dutcher <John_Dutcher at urmc.rochester.edu>
>
> The following is the start of a CGI script...
> It works fine 'until'...the very first 'non-'puts(1,"..\n")'
> is introduced. The two commented lines at the beginning will
> cause failure if uncommented..... no matter where they are placed.
>
> What's the secret to using the rest of the instruction set in a CGI ??
>
> #!c:\Euphoria\Bin\exw.exe
>
> -- build html page:
> -- integer fn
> -- sequence line
> puts(1,"Content-type: text/HTML\n\n") -- most important!
> puts(1,"<html><head>\n")
> puts(1,"<title>Blues Remits Splitter</title>\n")
> puts(1,"<body text=blue>\n")
> puts(1,"<center>\n")
> puts(1,"<H1>Blues Remittances for 7/28/04</H1>\n")
> puts(1,"<TABLE BORDER=1 BGCOLOR=pink>\n")
> puts(1,"<tr><td colspan=30>Received Date</td>\n")
> puts(1,"<td>Provider</td>\n")
> puts(1,"<td>Svc Year</td>\n")
> puts(1,"<td>Account #</td>\n")
> puts(1,"<td>Last Name</td>\n")
> puts(1,"<td>First Name</td>\n")
> puts(1,"<td>Mid Init</td>\n")
> puts(1,"<td>Sub Last Name</td>\n")
> puts(1,"<td>Sub First Name</td>\n")
> puts(1,"<td>Sub Mid Init</td>\n")
> puts(1,"<td>Date of Birth</td>\n")
> puts(1,"<td>HIC Number</td>\n")
>
> puts(1,"</tr></table>\n")
>
> --^----------------------------------------------------------------
> This email was sent to: ghaberek at wowway.com
>
> EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dd66.b7Ag8i.Z2hhYmVy
> Or send an email to: EUforum-unsubscribe at topica.com
>
> For Topica's complete suite of email marketing solutions visit:
> http://www.topica.com/?p=TEXFOOTER
> --^----------------------------------------------------------------
>
3. Re: CGI program only recognizes the "puts(1,"....\n") instr
Greg Haberek wrote:
>
> what's happening here, is exw is trying to report an warning saying that
> those variables have not been assigned a value. the problem is that your
> server (Apache?) won't allow the program to display any output to the
> screen, so it crashes. writing CGI in Euphoria is very difficult at first,
> since any error output to the screen causes the script to crash. try running
> your script on its own ("exw my_script_name.exw") first and see if you have
> any errors. if you can output only HTML and have no errors, then your script
> should run fine. to prevent unassigned variables from triggering warnings,
> use 'without warning' at the top of your script.
>
> another tip - if you're going to use include files in your scripts, you have
> to place them in the same directory as the main file, OR include them as the
> full path name
Another thing that can help is to use the crash_file() command to route
the messages to somewhere that the server has permission to write files.
You need to put it very near the top of your program.
Irv
4. Re: CGI program only recognizes the "puts(1,"....\n") instr
Hi John,
You wrote:
----------
> From: John F Dutcher <guest at RapidEuphoria.com>
> To: EUforum at topica.com
> Subject: CGI program only recognizes the "puts(1,"....\n") instr
> Sent: 2 aug 2004 y. 23:42
>
> The following is the start of a CGI script...
> It works fine 'until'...the very first 'non-'puts(1,"..\n")'
> is introduced. The two commented lines at the beginning will
> cause failure if uncommented..... no matter where they are placed.
>
> What's the secret to using the rest of the instruction set in a CGI ??
>
> #!c:\Euphoria\Bin\exw.exe
>
> -- build html page:
> -- integer fn
> -- sequence line
> puts(1,"Content-type: text/HTML\n\n") -- most important!
> puts(1,"<html><head>\n")
> puts(1,"<title>Blues Remits Splitter</title>\n")
> puts(1,"<body text=blue>\n")
> puts(1,"<center>\n")
> puts(1,"<H1>Blues Remittances for 7/28/04</H1>\n")
> puts(1,"<TABLE BORDER=1 BGCOLOR=pink>\n")
> puts(1,"<tr><td colspan=30>Received Date</td>\n")
> puts(1,"<td>Provider</td>\n")
> puts(1,"<td>Svc Year</td>\n")
> puts(1,"<td>Account #</td>\n")
> puts(1,"<td>Last Name</td>\n")
> puts(1,"<td>First Name</td>\n")
> puts(1,"<td>Mid Init</td>\n")
> puts(1,"<td>Sub Last Name</td>\n")
> puts(1,"<td>Sub First Name</td>\n")
> puts(1,"<td>Sub Mid Init</td>\n")
> puts(1,"<td>Date of Birth</td>\n")
> puts(1,"<td>HIC Number</td>\n")
> puts(1,"</tr></table>\n")
You can do the below trick to make your code
more clear and readable, try please,
may be useful:
puts(1,
"Content-type: text/HTML\n\n" & -- most important!
"<html><head>\n" &
"<title>Blues Remits Splitter</title>\n" &
"<body text=blue>\n" &
"<center>\n" &
"<H1>Blues Remittances for 7/28/04</H1>\n" &
"<TABLE BORDER=1 BGCOLOR=pink>\n" &
"<tr><td colspan=30>Received Date</td>\n" &
"<td>Provider</td>\n" &
"<td>Svc Year</td>\n" &
"<td>Account #</td>\n" &
"<td>Last Name</td>\n" &
"<td>First Name</td>\n" &
"<td>Mid Init</td>\n" &
"<td>Sub Last Name</td>\n" &
"<td>Sub First Name</td>\n" &
"<td>Sub Mid Init</td>\n" &
"<td>Date of Birth</td>\n" &
"<td>HIC Number</td>\n" &
"</tr></table>\n"
)
Regards,
Igor Kachan
kinz at peterlink.ru