This is probably not what you're looking for, because it sounds like the module is developed by your organization so you could eventually directly contribute to its final shape, and it's probably not what you should be doing, because there are usually better ways to change how you interact with a module, but:

In an old version of Path::Class, Path::Class::Dir had no "basename" method defined, while Path::Class::File did (and ::File didn't provide dir_list, etc). If you got passed some file object, there were multiple and mutually-exclusive code paths you could follow to get the file name. So I just added this to my module:

sub Path::Class::Dir::basename { $_[0]->dir_list(-1) }

This added that function, by its fully-qualified name, as "basename" into the "Path::Class::Dir" package, from within some other package! You could also do this with:

{ package Path::Class::Dir; sub basename { $_[0]->dir_list(-1) } }
Which is like opening the package, defining subs or creating variable or importing symbols, and then closing it.

You can also redefine existing subs in the same way (and surpress or ignore the resulting warning messages). But be very careful with this. Changing how an existing module works internally, especially when you redefine methods, without calling the originals, or change its internal data structures, can result in very confusing errors. This is especially prone to happen if the module is used in multiple places or ways in your program, eg indirectly by another module you're using.


In reply to Re: edit a module? by Anonymous Monk
in thread edit a module? by kosta

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.