The gotcha is that any attempts to use the builtins inside your module: return, split, delete, will result in calls to the subs in your package, not the builtins [...]

I can't find a test case for this behaviour - do you have an example?

There is a distinction between strong and weak keywords 1 which shows a slight difference in behaviour. With a strong keyword, the keyword overrides the subroutine:

zen% perl -wle 'my %hash; sub delete { die "not this one" } delete($ +hash{key})' zen%

A weak keyword gives a warning, but is still preferred to the subroutine:

zen% perl -wle 'sub bless { die "not this one" } my $a=bless({});' Ambiguous call resolved as CORE::bless(), qualify as such or use & a +t -e line 1. zen%

I'm sure I'm missing something that would justify your comment, but I can't offhand think what it is.

Hugo

1 The distinction between weak and strong keywords is probably not well documented; in older perls I think the only way to check was to examine the C code in toke.c, but happily perl-5.8.7 now bundle a script perl_keyword.pl to generate the code, which has clear lists of weak (@neg) and strong (@pos) keywords at the start of the script.


In reply to Re^2: Built-in Function Homonyms for Method Names Bad, Too? by hv
in thread Built-in Function Homonyms for Method Names Bad, Too? by jffry

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.