[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Question on adding code to perl.c



-----BEGIN PGP SIGNED MESSAGE-----

I've got a quick question for those more savvy in Perl internals than I
on this list.

One of the current problems is:
 2) We need to add /usr/lib/perl5/i386-linux/5.004 to perl-5.004's path.
    Otherwise, the various modules that are compiled and installed under
    the non-versioned Perl won't work.

The way I did this was with the following code:

    static char *archpath;
    STRLEN len;

    if (!archpath)
    {
        len = sizeof(ARCHNAME) + sizeof("/usr/lib/perl5//5.004");
        New(23, archpath, len, char);
        sprintf(archpath, "/usr/lib/perl5/%s/5.004", ARCHNAME);
    }
    incpush(archpath, FALSE);
    /* Safefree(archpath); */

I pulled some of this code from incpush itself.  I like the static
pointer idea, it's clever.  From a quick test, it doesn't look like
init_perllib only gets called once as the name might suggest, so I made
the pointer static and only allocated once.

Darren
- -- 
<torin@daft.com> <http://www.daft.com/~torin> <torin@debian.org> <torin@io.com>
Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996
@ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI/Pilot programmer/tutor @
@		     Make a little hot-tub in your soul.		      @

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv
Comment: Processed by Mailcrypt 3.5.1, an Emacs/PGP interface

iQCVAwUBN3JRlY4wrq++1Ls5AQGLKQP/SF4F9Cxr2T9zHve8E6BlOlgExb6ejlhj
3OHMOpRgJgkvGmuDOJKAYnMvUwyeiQW4hwRf914pPx5jOaFL5nx0jkyS4aMfdBW5
G116FntG4YfvFcA3VzdeDGNBSIop/jGQZpu98SdBqd7P5i5hfgoOcNB2oHtsqJNa
bATUEFwiLWY=
=esuM
-----END PGP SIGNATURE-----


Reply to: