Okay, I am done with the code I would like my new submodule to MP3::Napster contain. I have added several methods and a bunch of variables. I'm going to paraphrase the module below and then ask my questions so theyre in a relevant context.
# MP3::Napster, by Lincoln Stein package MP3::Napster; use MP3::Napster::MessageCodes; sub new { my $class = shift; # create and store the server object if (my $servobj = MP3::Napster::Server->new($server,$self,$metaserve +r)) { $self->server($servobj); } else { $self->disconnect; return; } $self->install_default_callbacks; $self; }
MP3::Napster::MessageCodes.pm looks like this:
package MP3::Napster::MessageCodes; require Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); @ISA = qw(Exporter MP3::Napster::Base); @EXPORT = qw(JOIN_ACK MOTD TIMEOUT TRANSFER ABORTED); 1;
What I would like to do is create a new module, MP3::Napster::OpennapMessageCodes.pm and another new module, MP3::Napster::Opennap. I have created a new 20-25 methods to add to the MP3::Napster.pm module, but they should be contained in another module. I have also created a new hash with message codes as they appear in the opennap source. How do I make these two modules part of the parent module without the parent module specifying them? In other words, how can I distribute a module that will make available methods to an object created from its parent module without the parent module having to be modified?

My second question is can I create a new MessageCodes module that will contain values in @EXPORT that are also in the "stock" MessageCodes module? Im pretty sure I can since theyre in a hash.

Thanks again, everyone. I think I will be writing a small module-howto when I get this whole thing done. By the way, I have Damian Conway's book. However, I am kind of at a loss on where and how to start with this. His book takes things from the perspective of creating a module, and thats not strictly what I am doing here.

dep.

--
i am not cool enough to have a signature.


In reply to 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.