Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

ActivePerl and -P option
Hi all,

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
compilation".

I tried this in 2 ways, and failed both ways:

1) I tried at the beginning of the perl script to put:
#!/usr/bin/perl -P
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,
Viv

Report this thread to moderator Post Follow-up to this message
Old Post
Viviana Vc
06-06-05 01:55 PM


Re: ActivePerl and -P option
"Viviana Vc" <vcotirlea@hotmail.com> wrote in message
news:3giffnFchadqU1@individual.net...
> Hi all,
>
> 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
> compilation".
>
> I tried this in 2 ways, and failed both ways:
>
> 1) I tried at the beginning of the perl script to put:
> #!/usr/bin/perl -P
> but by running the script I get:
> "Can't emulate -P on #! line at a.pl line 1."

As mentioned in the c.l.p.misc thread of the same name, this is as it should
be.

>
> 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?
>

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.)

Cheers,
Rob



Report this thread to moderator Post Follow-up to this message
Old Post
Sisyphus
06-07-05 01:55 PM


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
this solution.

Thanks,
Viv

On Tue, 7 Jun 2005 18:00:08 +1000, "Sisyphus"
<sisyphus1@nomail.afraid.org> wrote :

>
>"Viviana Vc" <vcotirlea@hotmail.com> wrote in message
>news:3giffnFchadqU1@individual.net... 
>
>As mentioned in the c.l.p.misc thread of the same name, this is as it shoul
d
>be.
> 
>
>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 per
l
>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 neede
d
>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.)
>
>Cheers,
>Rob
>


Report this thread to moderator Post Follow-up to this message
Old Post
Viviana Vc
06-07-05 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Modules archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:47 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.