Porting Perl app to Win32

I have an app that I wrote on a UNIX system and am in the process of porting it to a Win32 platform.  For the most part, various scripts seem to work fine.  I am running into a problem when one script calls another script inline like :
@list = `anotherscript.pl cmdlopt1 cmdlopt2`;

This format works fine under Unix but seems to not work at all under Win32.  I have not been able to get scripts to run that take command line options from a dos prompt either.

$ARGV[1] works for Unix but seems to have trouble under Win32.

Has anybody seen a similar problem and know a fix?
themaskAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kim RyanIT ConsultantCommented:
The back tick (`) notation is very old now. You could try this instead:
@list = system("anotherscript.pl cmdlopt1 cmdlopt2");

Ideally, you could turn anotherscript.pl into a module and then you can call any method (subroutine) in that module by the usual sub call approach.

Command line arguments should work fine in Windows. How are you invokong your script? You may have to say:
perl your_script.pl arg1 arg2
To test what gets in, do a print @ARGV as your first line.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
themaskAuthor Commented:
I got both problems fixed by playing around with it.  I had to call the perl interpreter explicity to get it to accept command line options.

I may look at modules in the future, but now I just need to get it functioning for a demo.  We don't plan on releasing a Win32 version currently.

As for the system call, that won't work because the script returns a list of values and the system call only returns the exit status (usually 1 or 0) from the executed application.
0
themaskAuthor Commented:
Thanks for the help, although I had it working before I heard from you.
0
Kim RyanIT ConsultantCommented:
YEs, perl for windows won't understand the #!/usr/bin/perl in the first line of scripts, so you have to invoke it explicitly.

By using modules to get around the back tick problem, you will make your code much more portable, so it's not really just a Winndows version. You may use other platforms in the future as well.
0
themaskAuthor Commented:
The scripts run without calling perl explicitly but they don't accept commandline options.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.