Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
Reading from textfiles on a server Posted by Niels on 25 Jun 2000 at 3:12 AM
Hey guys, i have a problem. For offline mode i use xitami webserver, when i let my script read and write some lines from/to a textfile it works perfectly. But if i upload it to my server (into cgi-bin of course) it doesnt work. For reading from and writing to files i use the "open" and "print <FILEHANDLE> 'some text'" methods <br>
(if they're called methods or functions or <br>
whatever :)<br>
<br>
What's the problem? do i do it wrong or is it a server error, or doesnt my server support such commands?<br>
<br>
Thnx a lot for any help


Edit Report
Re: Are the headers right? Posted by J. Worthington on 29 Jun 2000 at 12:55 PM
Hi!<br>
<br>
One thing I noticed when I used to use Xitami for testing (I've moved on to Apache since, as it is used on most of the webservers I host on) is that it isn't quite so worried about HTTP headers as other web servers. Make sure the first text that is printed is done by a line like:<br>
<br>
print "Content-type: text/html\n\n!;<br>
<br>
This should sort it out. Do this before you print any other HTML to the server.<br>
<br>
Also, make sure you are writing data to the file, rather than to the web server! For example:<br>
<br>
open FILE, "<textfile.txt";<br>
print "Text"; #This prints to the HTML page.<br>
print FILE "Text"; #This writes data to the FILE. Note that there is no comma needed.<br>
close FILE;


URL:http://www.jwcs.net/




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.