I find what you're doing a little confusing. If you want to add methods to MP3::Napster, you can certainly do that by having a second module that also defines things in the MP3::Napster namespace. For example, if your module is in ~/lib/MyNapster.pm,

package MP3::Napster; # *not* "package MyNapster;" sub blah1 { ... sub blah2 { ... sub blah3 { ... 1;

and then in your code you would have to use both modules to make your methods available.

#!/usr/bin/perl -w use strict; use MP3::Napster; use MyNapster; my $nap = MP3::Napster->new(); $nap->blah1(); ...

But that seems, well, odd. Certainly not in the spirit of the object oriented philosphy of encapsulation. Why not just subclass MP3::Napster? (In spite of what you say, depricated, I do think that you're creating a module -- a module that inherits and relies heavily on another, but that's exactly what oop is supposed to do.) Again, if your module is at ~/lib/MyNapster.pm,

package MyNapster; @MyNapster::ISA = qw / MP3::Napster /; sub blah1 { ... sub blah2 { ... sub blah3 { ... 1;

and then, essentially use MyNapster as you would MP3::Napster, but with your enhancements.

#!/usr/bin/perl -w use strict; use MyNapster; $nap = MyNapster->new(); $nap->blah1(); ...

There are a couple perl oop/module tutorials out there including perlmod, perlmodlib, perltoot, perlobj and perlbot. You ought to consult them before writing your howto to avoid doing redundant work. But fresh, new documentation is always appreciated!

HTH, Eric


In reply to Re: How do I create a submodule transparent to its parent without modifying the parent? by eg
in thread How do I create a submodule transparent to its parent without modifying the parent? by deprecated

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.