Perlmonks all:
...
Such a simple problem I have. It is so simple, I will explain at length.
OS is WinNT 4.0. Dinosaur! Can't do anything about that!
This script I am having problems with 'used' to work. It has been working for 7 years, used hundreds of times. Recently, (thanks to Misters Sarbane/Oxley) things have changed in accessing the system.
The script normally runs from Unix, from a shell script, where 'remsh' is executed on the NT server. The script is run as the 'root' user - which I log into using 'sudo su -'.
An example of the command that is run:
# remsh kirk -n "d:\perl\bin\perl d:\qad\srcmgr\mv_prog.pl -t -f d:\qa
+d\srcmgr\prog.lst"
Can't open \\kirk\QAD\TIMES2\LOG\comp_one.lst: Invalid argument
'kirk' is the NT server.
I can't figure this out, so I go to the NT server. I log in as userid 'root' - which is an Admistrator on the server. I open a 'cmd' window. I run the perl program string from the command line, and get this result:
D:\QAD\srcmgr>d:\perl\bin\perl d:\qad\srcmgr\mv_prog.pl -t -f d:\qad\s
+rcmgr\prog.lst
Processing file MGURMTP.P
\\kirk\QAD\MODS\US\SRC\MGURMTP.P is readable.
1 file(s) copied.
This is the result I would expect to get from running on Unix.
The perl script opens the file 'comp_one.lst'. It is in a variable, but the command that dies is:
open(COMPLIST, "> " . $CompFiles) || die "Can't open $CompFiles: $!\n"
+;
OK. The script fails when I run it from Unix, but runs on the NT server. I try another thing - I delete the 'comp_one.lst' file and run it in the command window again:
D:\QAD\srcmgr>d:\perl\bin\perl d:\qad\srcmgr\mv_prog.pl -t -f d:\qad\s
+rcmgr\prog.lst
Can't open \\kirk\QAD\TIMES2\LOG\comp_one.lst: Invalid argument
</code>
This tells me that the script really expects that 'comp_one.lst' file to be there so it can be opened. If it is not there, it gets the same error I get when I try to run it from the shell script on Unix.
But, when I run it from Unix, the file IS there. So, I think I am getting into some sort of permissions problem. And this may be more of an NT - permission - remsh error than a perl error. Anyone want to give me some insight here?
One definite perl question: is there a better way I can trap the error it gets when it tries to open the file? If the open fails - how can the perl program 'see' that and just create it if it isn't there, delete it and recreate it if it is there?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.