I think you should use or complement your current approach with a different strategy. Your sub names strongly suggest that your code should be split into multiple modules, probably OO ones. So you would have Mymod.pm as a base class with MyMod::Cisco, MyMod::Cisco::CPEthruHQ, MyMod::Cisco::CPE, MyMod::Telco, MyMod::Ericson as subclasses. Then you would simply have a base set of routines: getHostname(), getInterfaces(), login(), logout(), runCommands(), which would be overriden as necessary in the subclasses. This would reduce the initial load time since you would only load the baseclass and then let it load on the fly the appropriate subclass. And it would still be possible to use Autoloader, but with no possibilitiy of file name clashes, and most likely be much easier to work with.

You have to think that whenever you have subs named like you do that you probably are doing the subroutine equivelent of numbered variables like $x1,$x2,$x3, which is almost always a product of bad design. The same thing applied to subroutines, except that the solution is to use OO and not a hash or an array. (Although you could use a hash based dispatch table, but why bother, using subclasses is easier and is specifically designed for this type of scenario.)

---
$world=~s/war/peace/g


In reply to Re^2: Can perl modules be compiled? by demerphq
in thread Can perl modules be compiled? by mad_ady

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.