Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Using a shared object in perl

by Anonymous Monk
on Aug 20, 2011 at 02:48 UTC ( #921357=note: print w/replies, xml ) Need Help??


in reply to Using a shared object in perl

You need to ask for a copy of blib

Here is how it works

Save this module as SOso-0.01.patch.txt

diff -ruN empty/lib/SOso.pm SOso-0.01/lib/SOso.pm --- empty/lib/SOso.pm 1969-12-31 16:00:00.000000000 -0800 +++ SOso-0.01/lib/SOso.pm 2011-08-19 19:28:36.000000000 -0700 @@ -0,0 +1,11 @@ +package SOso; + +use strict; +use warnings; + +our $VERSION = '0.01'; + +require XSLoader; +XSLoader::load('SOso', $VERSION); + +1; diff -ruN empty/Makefile.PL SOso-0.01/Makefile.PL --- empty/Makefile.PL 1969-12-31 16:00:00.000000000 -0800 +++ SOso-0.01/Makefile.PL 2011-08-19 19:32:42.843750000 -0700 @@ -0,0 +1,5 @@ +use ExtUtils::MakeMaker; +WriteMakefile( + NAME => 'SOso', + VERSION_FROM => 'lib/SOso.pm', # finds $VERSION +); diff -ruN empty/MANIFEST SOso-0.01/MANIFEST --- empty/MANIFEST 1969-12-31 16:00:00.000000000 -0800 +++ SOso-0.01/MANIFEST 2011-08-19 19:32:23.609375000 -0700 @@ -0,0 +1,5 @@ +lib/SOso.pm +Makefile.PL +MANIFEST +SOso.xs +t/SOso.t \ No newline at end of file diff -ruN empty/SOso.xs SOso-0.01/SOso.xs --- empty/SOso.xs 1969-12-31 16:00:00.000000000 -0800 +++ SOso-0.01/SOso.xs 2011-08-19 19:30:12.000000000 -0700 @@ -0,0 +1,8 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = SOso PACKAGE = SOso + +PROTOTYPES: DISABLE + diff -ruN empty/t/SOso.t SOso-0.01/t/SOso.t --- empty/t/SOso.t 1969-12-31 16:00:00.000000000 -0800 +++ SOso-0.01/t/SOso.t 2011-08-19 19:29:00.000000000 -0700 @@ -0,0 +1,4 @@ +use strict; +use warnings; +use Test::More tests => 1; +BEGIN { use_ok('SOso') };

Create this module

md SOso-0.01 cd SOso-0.01 patch -p1 < ../SOso-0.01.patch.txt

Build the module perl Makefile.PL && make test and you'll get

$ tree -f blib blib |-- blib/arch | `-- blib/arch/auto | `-- blib/arch/auto/SOso | |-- blib/arch/auto/SOso/SOso.bs | `-- blib/arch/auto/SOso/SOso.dll |-- blib/bin |-- blib/lib | |-- blib/lib/SOso.pm | `-- blib/lib/auto | `-- blib/lib/auto/SOso |-- blib/man1 |-- blib/man3 `-- blib/script

Now to install blib without Makefile you use

 

This question crossposted at http://stackoverflow.com/questions/7113320/where-to-find-the-perl-shared-objects-directory

Replies are listed 'Best First'.
Re^2: Using a shared object in perl
by sherab (Scribe) on Aug 24, 2011 at 19:12 UTC
    It worked spot-on for actually building and patching. I wasn't aware of the patch command so I'm going to research this some more. Even after all of that though I'm still getting...
    perl: symbol lookup error: /usr/lib/perl/5.10/auto/mhdrg/mhdrg.so: und +efined symbol: Perl_Tstack_sp_ptr

    Every solution I have seen when googling "Perl_Tstack_sp_ptr" suggests recompiling the source and unfortunately we don't have access to that. I think we're just going to stand up a box running perl 5.8 so we can solve this but I really appreciate the answers.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://921357]
help
Chatterbox?
[atcroft]: Discipulus: I looked back at your note about my Padre question from a while back, and it made me look again... as a result, I found what I was missing and was able to make the change. Thank you!

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2018-02-24 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?