Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- ActivePerl and -P option
- Viviana Vc
June 6, 2005, 3:25 pm
rate this thread
I am new to perl, so I am new to these lists, but I hope I am posting in
the right groups.
I have installed on my Win 2k system the latest version of ActivePerl
5.8.6 (http://www.activestate.com /)
I have to write a perl script that uses some defines from an .h file. So
I decided to include in the perl script that .h file (i.e. #include
"a.h"), but in order to use those defines (i.e. #define ALFA "alfa") I
have to run the script through the preprocessor first, and the help says
this is supported: "-P run program through C preprocessor before
I tried this in 2 ways, and failed both ways:
1) I tried at the beginning of the perl script to put:
but by running the script I get:
"Can't emulate -P on #! line at a.pl line 1."
2) By running the perl with -P option I always get "The system cannot
find the path specified.". Any clue why do I get this error? Any clue
how could I fix this?
Any help would be most appreciated,
Re: ActivePerl and -P option
As mentioned in the c.l.p.misc thread of the same name, this is as it should
I don't think it can be fixed. I think "the path specified" is a path that
exists on the machine that built your perl, but doesn't exist on your
machine. (I have, however, so far been unable to find exactly what "the
specified path" is.) This would suggest that you probably need to build perl
yourself with MSVC++ 6.0 - but I find that even then, the '-P' switch
doesn't work. I don't get any error about the path being unfindable, but I
do get the error that my \perl\bin folder "is not recognised as as an
internal or external command, operable program or batch file".
Only way I can get a funtional -P switch on Win32 is to build perl with the
freely available MinGW compiler (and dmake).
Only way I could get pre-processing (like you're attempting) using
ActivePerl was to use Filter::cpp and the MinGW compiler - all that's needed
is to have the MinGW\bin folder in your path, and then Filter::cpp works
fine with ActivePerl.
It's probably not all that dificult to get Filter::cpp working with MSVC++
6.0 on ActivePerl - but I didn't actually get to achieve that (though I
spent 30 minutes or so trying).
I haven't found any difference between using the -P switch and using
Filter::cpp. For me, they both work fine as long as they have to deal only
with preprocessor directives. ie if your 'a.h' contains lines that are not
either preprocessor directives or comments (eg - contains function
prototypes) then both the -P switch and Filter::cpp will choke.
Is that adequate ? Let us know if it's not - I'm a little intrigued and
would be prepared to dig a little deeper if necessary. (Ideas on how to do
that would also be appreciated.)
Re: ActivePerl and -P option
Thanks for your answer.
In the end I chose to do as a prerun-step:
cl /EP a.pl > b.pl
where cl is the compiler of VC 7.1 that I have installed on my system,
and then run the b.pl.
Seems everything works as expected like this, so for now I'll stay with
On Tue, 7 Jun 2005 18:00:08 +1000, "Sisyphus"