From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23171 invoked from network); 5 Aug 1999 05:40:13 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Aug 1999 05:40:13 -0000 Received: (qmail 19846 invoked by alias); 5 Aug 1999 05:40:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7363 Received: (qmail 19819 invoked from network); 5 Aug 1999 05:40:01 -0000 From: "Bart Schaefer" Message-Id: <990805053949.ZM15277@candle.brasslantern.com> Date: Thu, 5 Aug 1999 05:39:49 +0000 In-Reply-To: <14248.30740.258799.3140@mrclean.Stanford.EDU> Comments: In reply to Jeff Solomon "Zsh and Perl?" (Aug 4, 11:13am) References: <14248.30740.258799.3140@mrclean.Stanford.EDU> X-Mailer: Z-Mail (5.0.0 30July97) To: Jeff Solomon , zsh-workers@sunsite.auc.dk Subject: Re: Zsh and Perl? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 4, 11:13am, Jeff Solomon wrote: } Subject: Zsh and Perl? } } I think a common task that many people are faced with is writing } little debugging tools. Frequently, they may write such a tool in a } language like Perl because it's so time efficient. You may very well be correct, but I'd like an example of such a tool if you can share one. I wouldn't have referred to any of the perl tools I write as "debugging" tools, but perhaps you're speaking as an admin who has to debug network connections or protocols, or the like. I say this because ... } So I'm asking the zsh developers about the best way to solve this } problem. Basically I want to [...] ... you seem to have already made up your mind about the best way to solve the problem, and I want to be convinced that you're right. Marrying perl to zsh isn't going to help people who write tools in awk or tcl or python. For example, have you considered running the debugging tool as a coproc? Nevertheless, to answer your specific questions ... } Embed perl into zsh: } } Looking at the source, this looks like the most straightforward } thing to do. It seems easy to add a 'perl_eval' command that would } evaluate a snippet of perl in a persistent interpreter. But I } would want to add command into the zsh enviroment from perl [...] Zsh 3.1.6 modules are the thing for this. For one thing, you can load and unload them dynamically; so you don't have to bloat zsh permanently with a perl interpreter, and you can force the interpreter to shut down if necessary -- and with a lot of OOPerl programs, that's required to get all the object cleanup to happen. For another thing, as of 3.1.6 loadable modules can export zsh parameters, so you can theoretically make the perl scalar namespace visible to zsh. You might even be able to make (copies of) perl arrays visible, and bits of perl hashes, though zsh doesn't have nested arrays/hashes. Finally, of course, zsh modules were originally designed to supply new builtin commands, and you can add as many as you like from each module. } Embed zsh into perl: } } zsh is turned into a loadable perl module and I write a script } directly using zsh. That would be a major engineering effort. Perl has already gone through the necessary transformations to become a linkable interpreter "library"; zsh has not, and I suspect it would be an ugly task to do so. } Has anyone done this yet? It's been mentioned a number of times, but nobody has ever been motivated enough to go through with it. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com