create text file with perl on windows 2000 server
I'm used to working on *nix servers and haven't really tested any of my scripts for windows. But I've got a client who is already payed up on a windows server and I am trying to migrate some of my services over to her new website, but I am finding that it appears like the windows 2000 server will not let my simple perl script create a flat text file. Is it not possible, or am I doing it wrong? I am simply trying to write to a file that isn't there.. in *nix it will automatically create the file and then write to it.
Thanks for any help.
webG
Pimpin like a pimp with an electrofied pimpin machine!
Mark Hensler posted this at 21:37 — 20th November 2003.
He has: 4,048 posts
Joined: Aug 2000
Do you get any errors?
ROB posted this at 07:52 — 21st November 2003.
They have: 447 posts
Joined: Oct 1999
open (OUTFILE, '>./outfile.txt') or die("Error opening file: $!");
print OUTFILE 'testin';
close OUTFILE;
works fine.
Ken Elliott posted this at 13:53 — 21st November 2003.
They have: 358 posts
Joined: Jun 1999
D:\inetpub\wwwroot\014143\sc3eb59g\cgi-bin\test.cgi' script produced no output
#!/usr/bin/perl
open (OUTFILE, '>./outfile.txt') or die("Error opening file: $!");
print OUTFILE 'testin';
close OUTFILE;
print "Content-type:text/plain\n\n";
print "Created";
if I comment out the outfile, it works fine of course. I'm trying to track down the error log on this server, I hate windows servers :flame:
thanks
webG
Pimpin like a pimp with an electrofied pimpin machine!
ROB posted this at 17:09 — 22nd November 2003.
They have: 447 posts
Joined: Oct 1999
hmm, works for me on win2k pro from both the command line and through Apache. Maybe it's an IIS permissions issue ...
Wil posted this at 16:12 — 23rd November 2003.
They have: 601 posts
Joined: Nov 2001
I *think* your IIS isn't properly configured to handle CGI.
Is Perl setup correctly on the server? There are a few example test scripts (like, hello world!) included with all Perl distributions in /examples. Try those out.
Is your path to Perl correct in the shebang line and has an env. variable been set in Windows to instruct IIS to open .pl or .cgi with Perl?
- wil
Ken Elliott posted this at 01:25 — 24th November 2003.
They have: 358 posts
Joined: Jun 1999
all of the scripts run fine so long as they don't try to create a file. I guess it was a permissions thing, I got server support to give me write access to a folder. I remember from my readings a while back something about windows servers not having permissions. I know that I couldn't change them through an ftp client, that was enough proof for me.
So I guess there is no way to change permissions or give myself write access to a folder I create with an ftp client?
ken
Pimpin like a pimp with an electrofied pimpin machine!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.