zsh-workers
 help / color / mirror / code / Atom feed
* Zsh perl module
@ 1999-08-26  4:09 Mike Fletcher
  0 siblings, 0 replies; only message in thread
From: Mike Fletcher @ 1999-08-26  4:09 UTC (permalink / raw)
  To: zsh-workers


        Well, I've gotten several mails indicating interest in my perl 
module.  I've got a rough (*very rough*) patch ready and on the web:

http://www.phydeaux.org/perl/zperl-0.01.patch.gz


        Something along the lines of the following should (in theory)
get you a zperl.so that can be zmodload'd when run against a copy of
the zsh-3.1.6 source tree:


cd ..../zsh-3.1.6
gunzip < zperl-0.01.patch.gz | patch -p1
./configure ...         # may not be needed if already configured

cd Src
make modules            # this will fail, see below

cd Modules/zperl
sh ./makezperl          # this is a kludge

cd Zsh                  # Then install the perl side of things
perl Makefile.PL && make install


        As I said, it's rough at the moment.  Any sugguestions how to
get perl's cflags and ldflags into the mdd file in the correct way
would be welcome (they're generated with something like:

        `perl -MExtUtils::Embed -e ccopts`

and the objects="" setting didn't like having -lfoolib in it).


        There's not really any documentation to speak of, but the
commands are (once you've done `zmodload zperl.so'):

List any perl defined builtins commands 
zperl -l 

Have the perl interpreter require a perl module
zperl -r Perl::Module

Define a zsh builtin as a perl subroutine
zperl -b foo Perl::Sub

Undefine a builtin defined by zperl -b
zperl -u foo


        I've been using a perl module along the following lines for
testing.  Put this in a file named Ztest.pm somewhere that perl can
find it and do `zperl -r Ztest ; zperl -b perl_eval Ztest::eval'.  You 
can then evaluate arbitrary perl code with the new `perl_eval'
command.

---->8 Cut Here 8<----
package Ztest;

use Zsh;

sub eval {
  my $code = shift;

  eval " $code ";

  if( $@ ) {
    warn "Error during eval: $@\n";
    return 1;
  } else {
    return 0;
  }
}

1;

__END__
---->8 Cut Here 8<----

-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch@phydeaux.org   |  Vincent, you should cease askin'          \ o.O'
678 443-6239(w)       |  scary questions." -- Jules                =(___)=
                      |                                               U


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-08-26  4:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-26  4:09 Zsh perl module Mike Fletcher

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).