in reply to Re^3: Perl5 patches
in thread Perl5 patches

You can override CORE::GLOBAL::substr from C as well.

Any pointers?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^5: Perl5 patches
by Corion (Patriarch) on Mar 18, 2012 at 20:51 UTC

    I tried something on my own and failed. Then I remembered overload::eval, which does that, except for OP_ENTEREVAL. If you replace OP_ENTEREVAL with OP_SUBSTR, that should be all you need, save for the rewrite of substr. But then you can step-wise refine it.

      Thanks. That all looks pretty straight forward. Well, 'ceptin' these couple of lines:

      #if ((PERL_VERSION == 13) && (PERL_SUBVERSION >= 7) || (PERL_VERSION > + 13)) hook = cophh_fetch_pvn(PL_curcop->cop_hints_hash, "overload::eval" +, 14, 0, 0); #else hook = Perl_refcounted_he_fetch( aTHX_ PL_curcop->cop_hints_hash, +Nullsv, "overload::eval", 14 /* strlen */, 0, 0); #endif

      But I guess it's a case of, cargo-cult it and see how it goes :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        I think that is just because OPs weren't really hookable before 5.13.x. As your goal is something for the newer editions, I would explicitly require 5.14.x, but on the other hand, cargo-culting doesn't hurt you more than it hurts overload::eval :)