Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
However, sometimes, what is available is a little less than what is wanted.

Whenever you encounter a module which provides a little less, you have 3 ways to add the missing bits (using Number::Format and Util::Number in the following):

  1. copy the source of Number::Format to Util/Number.pm, add the missing subroutine and use your renamed private copy (brittle)
  2. write Util::Number as a subclass which uses Number::Format and extends its functionality with your own subs (better)
  3. switch packages in your code and add the enhanced subroutines there (hack)

The first decouples you from the development of Number::Format. You'd have to update your private module if you want to benefit from the improvements of Number::Format as it developes.

The second possibility places on you the tiny burden of writing tests for your module, but only for those bits you have added.

The third may be used if and only if a) you use Number::Format only in one place, b) the added bits are trivial, c) you know where to look when things break.

So, I'd go with number 2.

package Util::Number; use parent Number::Format; sub pretty_number { ... } 1;
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re: Is what you want available? by shmem
in thread Is what you want available? by Lady_Aleena

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (2)
    As of 2019-09-22 18:11 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The room is dark, and your next move is ...












      Results (273 votes). Check out past polls.

      Notices?