I tried the following...
open(TP, "$file") or print "Cannot open the file ";
It printed the the value on the browser "Cannot open the file "
so now its confirmed....it cannot open the file thru browser....
Main Topics
Browse All TopicsI have a CGI script running on my desktop with APACHE as web server.
In my CGI/Perl script, I am doing
open(TP, "> $file") or die "Cannot open the file";
print TP "TESTTTTTTTTTTTTT \n";
close TP;
$file is the path not on my desktop (C:) but on a network share....
After executing the script....It does not create the file...also it does not throw any error message saying that it cannot open file or so...
I can manually create the file on network share from command prompt but not through teh CGI script
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
perlperl,
your code is fine.. there is no problem with that..
you should print out what $file though it may not be what you expect...
i.e.
my $file = '\\\dfs.ml.com\amrs\groups
will result in
\\dfs.ml.com\amrs\groups\i
its strange that you are not getting any error message fom perl... try running just the open and file write in a script and run it via the command line if you can..
create your file in a directory where you have permission to i.e. where your cgi script is running from or somewhere else on your c drive. Once the file is complete you can ftp this file to the network location of the s drive.
if my s drive is connected to \\dfs.ml.com\amrs\groups\i
whats stopping you from ftping the completed file to the location \dfs.ml.com\amrs\groups\in
what do you think?
http://www.thescripts.com/
this article may help you out...
Yeah i tried that
I get
Cannot open the file for write Invalid argument at C:/Program Files/Apache Group/Apache2/cgi-bin/test
and line 96 contains
open(FILE, "> $file") or die "Cannot open the file for write $! ";
and $file = "S:\\temp\file.txt" ## its the file on network....
why can't i open this file...what permissions do i need to set....
Another thing to notice and be aware of is that you're using double quotes in the assignment, which tells Perl to do variable interpolation. Since you don't need the interpolation in that assignment, you could/should use single quotes. In which case, either the forward slash or a single backslash would work as the path separator.
Business Accounts
Answer for Membership
by: perlperlPosted on 2007-12-07 at 06:06:30ID: 20427400
I also tried to open the file in read mode and display the contents of file...The CGI script didn't fail saying it cannot open the file...but at the same time it did not display the output of file contents...which means it didn't open the file...