cons-discuss
[Top][All Lists]
Advanced

[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!
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]