[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Perl function in a Command method
From: |
Zachary Deretsky |
Subject: |
Perl function in a Command method |
Date: |
Wed, 22 Nov 2000 11:47:27 -0800 |
Thanks, Steven and Gary.
I used the latest cons from subversions and it has Gary's patch with [perl]
clause.
I am still unclear about local Conscript variables and environments.
My understanding is that local conscript vars (lists, for example)
I can pass as args to my perl function and make them available this way.
What is the recipe for getting the environment?
My function opens a pipe to python and when I ran it as straight perl
it worked fine (unexplicably?),but when I call it from the Command
method PYTHONPATH apparently gets cleared and python cannot load its
library modules.
What is available when the function is defined in the main package?
Thanks, Zach.
>
> Funny you should ask; I have a patch for this also. You just put
> [perl] in the front of your command, then it's executed directly in
> your perl. Hope it's not too obnoxious to send it to the whole list.
>
> *HOWEVER*, there are some issues regarding name spaces with this kind
> of thing (same kind of thing happens with perl code in QuickScans).
> Cons reads each Conscript into the "script" package, after deleting
> all vars from that package (to clear cruft left around in other
> Conscripts). This makes it more difficult to refer to variables in
> the Conscript. Specifically, you can't refer to the cons
> environments: they're gone by the time commands are run. I've been
> kicking around some ideas about putting each Conscript into its *own*
> package rather than reusing "script" each time, but I don't really
> know what kinds of issues this would create. (Anyone else but me care
> about this?)
>
> What I usually do is put anything I'll need in the [perl] commands
> into the 'main' package, but you can do it however you like.
>
> Here's my patch. This is against a fairly old cons version, but it
> shouldn't be too hard to shoehorn into recent builds, I hope. Let me
> know how you like it!
>
>
- RE: Cons with output in Separate Subdirectories., (continued)
- RE: Cons with output in Separate Subdirectories., Greg Spencer, 2000/11/13
- RE: Cons with output in Separate Subdirectories., Greg Spencer, 2000/11/13
- RE: Cons with output in Separate Subdirectories., Greg Spencer, 2000/11/13
- Re: Cons with output in Separate Subdirectories., Giovanni Pietrobon, 2000/11/16
- RE: Cons with output in Separate Subdirectories., Greg Spencer, 2000/11/17
- Filename globbing, Zachary Deretsky, 2000/11/17
- Perl function in a Command method, Zachary Deretsky, 2000/11/21
- Re: Perl function in a Command method, Steven Knight, 2000/11/22
- Re: Perl function in a Command method, Gary Oberbrunner, 2000/11/22
- Re: Perl function in a Command method, Steven Knight, 2000/11/22
- Perl function in a Command method,
Zachary Deretsky <=
- 'AfterBuildAll', Marcello Pietrobon, 2000/11/30