CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
File Access

 



dckid
Deleted

Feb 15, 2001, 5:09 AM

Post #1 of 2 (265 views)
File Access Can't Post

Hi,
I'm very new to perl (I have a bit of experience in other languages though, not much) so this may be simple...

For some reason my perl files can't seem to access external files when I run them. This goes for scripts that I have downloaded and coded myself. Perl runs the scripts fine, but no matter what it will not open the datafiles and just dies when it tries to.

I've tried everywhere I can think of for help on this one, if anyone can work out what's wrong I would be very grateful!



muinatit
Deleted

Feb 15, 2001, 12:24 PM

Post #2 of 2 (257 views)
Re: File Access [In reply to] Can't Post

1 - Make sure your paths are right.
2 - Make sure the files are coded right.
3 - Make your code have good error messages. (See below)
4 - Add in extra debugging features. (See below)

Here's a sample script that would be very easy to debug..


Code
#!/usr/bin/perl -w 
use CGI::Carp qw(fatalsToBrowser);

open (INF, "noexsistfile.txt") || die "noexsistfile.txt: $!";
print $_ while (<INF>);
close (INF);
exit;

Jeffrey "muinatit" Lamoureux
muinatit@hotpop.com

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives