On Wed, 2006-14-06 at 10:58 -0400, Doug Adams wrote: > I'm a first time perl user, jumping right into cgi on a mac, and I can't > for the > life of me figure out how to specify file paths other than to the > CGI-Executables folder (where my program is), or any subdirectory thereof. I > have been bashing my head against my desk for the last couple days and I can > assure you that nothing useful has come out. It has to be something simple I > haven't tried...
You can specify an absolute path to a file the same way you would from the command line: my $file = '/path/to/my/file.txt'; Things you should add to your CGI: 1. Added this line: use CGI::Carp qw( fatalsToBrowser ); This sends all fatal errors to the web page. 2. Make sure all open statements are tested and report the file name in the error message: open IN, '<', $file or die "cannot open $file: $!"; 3. Close all file handles especially writes: close OUT or die "cannot close for writing file handle OUT: $!"; Other things to do: 1. Make sure the directories are readable and executable by the userid or groupid that the web server is using. 2. Make sure the directory where you write a file is writable by the userid or groupid of the web server. 3. If the write file already exists, make sure it is writable by the userid or groupid of the web server. -- __END__ Just my 0.00000002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle * Perl tutorials at http://perlmonks.org/?node=Tutorials * A searchable perldoc is at http://perldoc.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>