|Don't ask to ask, just ask|
Re: Creating bash functions using perls $ENV interfaceby sauoq (Abbot)
|on Oct 29, 2003 at 03:11 UTC||Need Help??|
:-) (And suddenly it occurred to me that export -f had to work somehow.)
The following was my original reply. When I updated this node after finding a Real Answer™ for the OP, I struck this out. The suggestions below aren't wrong though and someone may still find them useful; so I'm unstriking them.
As far as I know, there's no way to do exactly what you are asking for. Every process has an environment, and yes, perl gives you access to its with %ENV; but not every process has bash functions... if you see what I mean.
There are ways you might be able to get around it. You can call your perl script from a bash script which itself declares and exports the function you want available to the shells started from your perl script. Something like this:
and in script.pl:
Or, you might try opening a pipe to a bash process, writing the functions out to that pipe and keeping it open to run your other scripts.
-sauoq "My two cents aren't worth a dime.";