develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [perl #8860] .pmc extension not documented in require

From:
David Dyck
Date:
May 9, 2003 09:29
Subject:
Re: [perl #8860] .pmc extension not documented in require
Message ID:
Pine.LNX.4.51.0305090853080.2825@dd.tc.fluke.com



On Fri, 9 May 2003 at 15:47 -0000, Casey West <perlbug-followup@perl.org> wrote:

> What you want is B::C.

Casey,
 I'm not sure why you say I want B::C. I didn't see B::C mentioning
.pmc files, so perhaps you are trying to tell me that there
is a better way to generate an .pmc file using B::C

My bug report was that .pmc files don't seem to be documented,
but yet perl stat's and uses .pmc files.

I was thinking that if the code in S_doopen_pmc() in pp_ctl.c
is not supposed to work then .pmc files should be removed.

S_doopen_pmc(pTHX_ const char *name, const char *mode)
{
    STRLEN namelen = strlen(name);
    PerlIO *fp;

    if (namelen > 3 && strEQ(name + namelen - 3, ".pm")) {
        SV *pmcsv = Perl_newSVpvf(aTHX_ "%s%c", name, 'c');
        char *pmc = SvPV_nolen(pmcsv);
        Stat_t pmstat;
        Stat_t pmcstat;
        if (PerlLIO_stat(pmc, &pmcstat) < 0) {
            fp = PerlIO_open(name, mode);
        }


When I looked around a little more
I found
           $ perlcc -B file            # Compiles using the bytecode backend
mentioned in perldoc perlcc

I tried some variations on that and
was able to get the desired results

dd:tmp$ perlcc -B Echo.pm -o Echo.pmc
/usr/local/bin/perlcc: Will not create a shared library for bytecode
dd:tmp$ perl -e 'require Echo'
Hello World

I think that the bug I reported was based
on the instructions in ext/B/NOTES that states
        perl -MO=Bytecode,-m,-oFoo.pmc Foo.pm

I now see the disclamer in perlcompile.pod :-)
B::Bytecode
        Stores the parse tree in a machine-independent format, suitable for
        later reloading through the ByteLoader module. Status: 5 (some things
        work, some things don't, some things are untested).





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About