Congrats on your first CPAN module!

This is more a nit than it is an operational fix, but I always prefer to see hash-based params passed in as a hash reference, as opposed to a hash:

this({ string => $string, times => 10, }); sub this { my $p = shift; # all params in hashref print $p->{string} x $p->{times}; }

I find it easier to track and organize things, and if you ever want to pass in another non-hash-based parameter later on down the road, it's much simpler than having to refactor your code to suit the new arg list. I wrote about this a few years ago.

my $href = { string => "Hello, world!" }; my $previous_error = $error; this($href, $previous_error); sub this { my $p = shift; # all params in hashref my $prev_error = shift; if (not $prev_error){ print $p->{string}; } }

Also, it might be worth setting some reasonable defaults instead of forcing the user to send in all parameters for every call:

this(); sub this { my $p = shift; $p->{hostname} = $p->{hostname} || "0.pool.ntp.org"; $p->{port} = $p->{port} || 123; }

-stevieb


In reply to Re: RFC: Net::SNTP::Client v1 by stevieb
in thread RFC: Net::SNTP::Client v1 by thanos1983

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.