Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl CGI & File I/O Problem

Reply
Thread Tools

Perl CGI & File I/O Problem

 
 
Mike
Guest
Posts: n/a
 
      04-07-2005
I have a simple Perl script that works good as a standalone script that
I want to migrate to work from a web page link.

The script opens a file and does a couple greps to pull out specific
lines from the file and report to the user.

For the CGI script (not using CGI pm and can not use it) as soon as I
hit the open statement all output to the web page stops. For example:

{All the html header stuff printed before this}

printf("Line 1");
open ...
printf("Line 2");

I will see Line 1 but not Line 2

I put all the file i/o and grep/substr work in a sub and called it
first and now I get an Internal Server Error message. Looks like no
output is being generated at all.

If I comment out the open statement I see all my literals output minus
the info I read from the file.

It almost appears that when I hit the open statement, perl loses the
standard out file handle - ?

Is there something special I'm missing about using file IO in a CGI
script?


Any help would be appreciated.


Thanks
Mike

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      04-07-2005
"Mike" <(E-Mail Removed)> wrote in
news:(E-Mail Removed) ups.com:

> I have a simple Perl script that works good as a standalone script
> that I want to migrate to work from a web page link.
>
> The script opens a file and does a couple greps to pull out specific
> lines from the file and report to the user.
>
> For the CGI script (not using CGI pm and can not use it)


Why not?

> printf("Line 1");
> open ...
> printf("Line 2");


....

> Is there something special I'm missing about using file IO in a CGI
> script?


Well, there is really no information upon which one can provide any
pertinent advice. All I can do is to suggest that you read:

perldoc -q 500
perldoc -q CGI

and the posting guidelines for this group.

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      04-07-2005
Mike <(E-Mail Removed)> wrote:

> (not using CGI pm and can not use it)



Why is it that you cannot use the CGI module?


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      04-07-2005
Mike wrote:

> Is there something special I'm missing about using file IO in a CGI
> script?


Don't use die() unless you have ensured that the required HTTP
headers have been output first.

Be careful when using select() - it can redirect output that would have
gone to STDOUT.

Never attempt to access /dev/tty in a CGI program.

Post a short but complete program so that we can attempt to
reproduce your problem.

-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommendation for a small web framework like Perl's CGI::Applicationto run as CGI? excord80 Python 17 01-29-2009 06:02 PM
what's wrong calling a Perl/CGI script in Perl/CGI script under Tomcat server? kath Perl Misc 4 04-09-2007 09:21 PM
Python-cgi or Perl-cgi script doubt praba kar Python 1 07-30-2005 08:25 AM
perl/cgi exploit with bracketed module names passed in as CGI param shumsta Perl Misc 1 07-21-2005 11:30 PM
Re: CGI Perl "use CGI" statement fail Jürgen Exner Perl 0 07-31-2003 02:00 PM



Advertisments