Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Perl on Win98 vs. Win/NT/2000?

by dws (Chancellor)
on Sep 08, 2001 at 03:19 UTC ( [id://111077]=note: print w/replies, xml ) Need Help??


in reply to Perl on Win98 vs. Win/NT/2000?

If a command runs at the DOS prompt, I expect it to run when shelled from Perl. Is this asking too much?

Sadly, the answer in some cases is Yes. I'm not sure of why this is.

I've been able to work around this in most cases by doing one of

  1. system("map > temp"); open(M, "<temp") or die ...; @dmap=<M>; close(M);
  2. open(M, "map|") or die ...; @dmap=<M>; close(M);
How does the latter case differ from backticks? Perhaps someone with Deep Knowledge will educate us.

(I'm assuming that you have a DOS executable named "map". I don't, but I've run into this problem with other programs.)

Replies are listed 'Best First'.
Re:x2 Perl on Win98 vs. Win/NT/2000?
by grinder (Bishop) on Sep 10, 2001 at 11:19 UTC

    Back in the olde dayes, of Windows 3.11 and Perl running under a DOS extender, and at least for a while afterwards, back-ticking in Perl did exactly what DOS did: it ran the source program, spooled the output to a temporary file until it ended, then started executing the target file, feeding it the contents of the spooled output.

    This is how all std(in|out) DOS redirection worked. So by doing it explicitly in Perl, while more verbose, at least has the advantage of bringing it all out in the open, and you are less reliant on DOS jiggery-pokery.

    AFAIK, this output-spooling behaviour is still the norm for Win98, but someone else may like to confirm.

    --
    g r i n d e r

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://111077]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-20 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found