I'm wondering if there's a better way to avoid the warning of "Ambiguous use of X resolved to Y".
Here's what I did:
# issues "Ambiguous use of X resolved to Y" warning that # I don't know how to turn off, these don't work: # $SIG{__WARN__} = sub{} # $^W = 0 # no strict 'refs' my $old_scan_podpath = *{Pod::Html::scan_podpath}{CODE};
I couldn't get rid of the warning generated from that line of code, so I went with this:
# issues "Subroutine X redefined at Y" warning, but # I can turn that one off with $^W local( $^W ) = 0; # Needed because I'm using a symbolic ref now. no strict 'refs'; my $old_scan_podpath = *{'Pod::Html::scan_podpath'}{CODE};
That seems to work.

After that's set up, I can do this:
local(*Pod::Html::scan_podpath) = sub { # do stuff here # call the old implementation &$old_scan_podpath; # uses @_ };
And yes, I'm aware of a few wrap modules out there, but for some reason I didn't want to add more dependencies to this script than I already have. Besides, it seemed like a good opportunity for me to learn how to do this.

So, am I avoiding that warning the right way? Or is there a better way?

Thanks!
-Dave

In reply to Ambiguous use of X resolved to Y by dpmott

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.