In the general case, core functions can be overwritten by setting a reference in their slot in *CORE::GLOBAL at compile time. Then at runtime, when functions are called, the sub ref in that slot is used in place of the CORE:: function. (You almost never really want to do this, though.)

But, the problem here is of course that my and our aren't runtime functions. They are compile-time directives. If you are using a perl that is pre-our, and you try to map our->my (ignoring that they are very different things) you have a big problem: your fake our is called at runtime, after compile-time strict warnings are issued.

You can create an 'our()' subroutine, but it won't solve your problem: by the time it is called, it's too late. You need to intercept the source code before compile time (with a source filter, ick) or just suck it up and replace all the ours with use vars. You want that anyway, since replacing our with my is bound to break things badly, assuming the original use of our wasn't frivolous.


In reply to Re: Having one sub routine point to another by fishbot_v2
in thread Having one sub routine point to another by cosmicperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.