In general it is best to sub-class an existing module. Although it may not be easy or straightforward it is generally possible.

Unfortunately in this case it doesn't seem to be very feasable. The problem is that almost all of the calls within the module are hard wired to each other. Even though there is a Benchmark object (blessed using the single argument form!) none of the routines take $self references so they can't be called as methods, and should I call one as a procedure then it will call all of its friends as procedures, completely ignoring what overriden methods I have provided.

So the question for me was total ground up rewrite in my own module or to convert the entire thing into an OO version?

I chose the later and have now completed the majority of work converting it into an OO structure. This basically meant trawling the code for subroutines and subroutine calls and adding in a $self pointer, splitting out functionality into different objects etc. Now I could reimplement the original package just through calls to mine, but no way I could go the other way.

Once Im done I plan to post it here for revue and comments.

Although as the module has no copyright information I think I might need permission.

Yves
--
You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)


In reply to Re: Re: Working with Standard Modules... by demerphq
in thread Working with Standard Modules... by demerphq

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.