Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Perl and ZSH (WAS: Re: backing up with zsh)



On Apr 17,  7:44pm, tep@xxxxxxxxxxxx wrote:
} Subject: Perl and ZSH (WAS: Re: backing up with zsh)
}
} I've actually been tinkering with the idea of embedding a Perl
} interpreter inside ZSH

I can't convince myself that this is a good idea.  You'd have to change
zexecve() in order to get perl programs to run in the internal interpreter
(i.e., you couldn't let the kernel interpret #!/usr/bin/perl), which would
be a performance hit on every binary exec.  Also, there's a fundamental
difference between shell scripts and perl programs that would make it very
impractical to have the perl interpreter state hang around for the entire
time the shell is running; but if you shut down the interpeter after every
call, you haven't gained much by making part of the shell.

That said, however:

} but I got stumped when it came time to
} think about sharing data (i.e. variables and such).

Make it a loadable module using the new facilities in 3.1.x.  Forget about
sharing anyting other than environment variables, which will "just work";
it's easy enough to "export" variables from zsh and stuff things into the
%ENV hash in perl, if values really need to be passed back and forth.  (I
suppose you might need to do a little tweaking, in case perl ignores the
actual environ array after first setting up %ENV.)

Make the interface to perl look like a builtin shell function, so that the
existing zsh code handles argv and i/o redirection.

} Anyone care to assist in this endeavor??  :-)

Not more than I just did.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author