Loading external module from XS file?

PERL

    Next

  • 1. What is the replacement for Signals in Perl 5.8 on Win Platforms
    The following script works as expected on perl 5.6, but not on perl 5.8. Q: How to solve this in Perl 5.8 (I'm using ActivePerl)? ----8<----8<----8<----8<----8<----8<----8<---- #!perl -w use strict; sub handler { warn "Hello\n"; $SIG{INT} = \&handler; } $SIG{INT} = \&handler; my $x = 0; while (1) { last if ((++$x) == 20); sleep 1; printf("$x\n"); } ----8<----8<----8<----8<----8<----8<----8<---- Expected behaviour: Each CTRL-C (within the first 20 seconds) prints "Hello" on the console. Perl5.8 behaviour: CTRL-C terminates the program. Any hints are very much appreciated. Thanks Andi
  • 2. [NEW MODULE] IO::Filter
    I've written a module that acts as a wrapper around filehandles. So, you might use it as an input filter: use IO::Filter; IO::Filter::make {s/foo/bar/} *STDIN, *WRAPPED; while (<WRAPPED>) { print; } or an output filter: use IO::Filter; IO::Filter::make {s/foo/bar/} *STDOUT, *WRAPPED; while (<>) { print WRAPPED $_; } Of course, wrappers stack too: IO::Filter::make {s/foo/bar/} *STDIN, *X1; IO::Filter::make {$_=uc} *X1, X2; This way, you can implement a basic shell-like pipelining infrastructure. Is the attached module suitable for CPAN? -- Andrew Stribblehill Systems programmer, IT Service, University of Durham, England

Loading external module from XS file?

Postby Marcin Kasperski » Tue, 20 Jul 2004 20:25:03 GMT

Probably simple question: what is the easiest and the most natural way
to use/require external module from the XS source? 

----- End forwarded message -----

Re: Loading external module from XS file?

Postby Tassilo v. Parseval » Wed, 21 Jul 2004 00:01:39 GMT

Also sprach Marcin Kasperski:


I think you want load_module(), see perlapi.pod.

For a require() you can use:

    eval_pv("require Module;", FALSE);
    if (SvTRUE(ERRSV)) {
	croak(...);
    }

You can use the above to trap otherwise fatal errors.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval

Re: Loading external module from XS file?

Postby Marcin Kasperski » Wed, 21 Jul 2004 00:56:12 GMT

"Tassilo v. Parseval" < XXXX@XXXXX.COM > writes:


I sought for something without parsing. Seems load_module is the
answer, thanks. Any info at which perl version it occured (in 5.6.1 it
is not documented)?

Similar Threads:

1.File::Glob can't load module [cygwin], perl-5.8.4 9 (newbie)

I am playing with compiling Perl 5.8.4 under cygwin.  Can anyone help me fix
the error I seem not get past?

./perl harness
Can't load module File::Glob, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the File::Glob module statically linked into it.)
 at harness line 52
Compilation failed in require at harness line 52.
BEGIN failed--compilation aborted at harness line 52.

I was trying to compile using:
sh Configure -Duse64bitint \
-Duseshrplib \
-Dprefix=/u01/app/perl \
-Dinstallusrbinperl=n -Dcc=gcc  -Doptimize='-O2' \
-Dperladmin='<e-mail address>'  -des

Thanks!




Return to PERL

 

Who is online

Users browsing this forum: No registered users and 75 guest