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

Re: Perl Calling Perl! :P

by cdarke (Prior)
on Jul 22, 2011 at 07:04 UTC ( #916066=note: print w/replies, xml ) Need Help??


in reply to Perl Calling Perl! :P

One thing to be careful of when running Perl scripts from Perl on Windows (or any other similar language from Windows) is that file association is only done by a shell, like cmd.exe or Windows Explorer. So, if you call system('myscript.pl'); then it probably won't work, since perl will not invoke a shell which it considers unnecessary.

There are several solutions. The simplest is just system('perl myscript.pl'); but that assumes that %path% is set correctly. You could specifically invoke cmd.exe, or, to take an extreme, use Win32::FetchCommand which will do the registry lookup required for file association.

UNIX style operating systems don't have this issue because of the #! line.

Replies are listed 'Best First'.
Re^2: Perl Calling Perl! :P
by bingos (Vicar) on Jul 22, 2011 at 09:48 UTC

    Or you can use $^X

    system($^X, 'myscript.pl');

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2021-04-22 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?