Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?

In reply to Open: Invalid Argument by jhs3

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-24 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found