1) know your tools
# Convert the decimal to hexadecimal and pad the result with a lea +ding # zero if needed. my $hex = sprintf("%x", $dec); $hex = length( $hex ) == 1 ? "0".$hex : $hex;
way too complicated
my $hex = sprintf '%02x', $dec;
conversion table
  0 -> 00
  1 -> 01
 15 -> 0f
 20 -> 14
255 -> ff
256 -> 100    # garbage in, garbage out
2) nesting subs does not work:
sub basicSNTPSetup { ... sub keyDifference { .. }; };
is equivalent to
sub basicSNTPSetup { ... }; sub keyDifference { .. };
3) dead code / sub-ref / conditional
my $verify_port = sub { my $port = shift; if ( defined $port && $port =~ /^[0-9]+$/ ) { if ( $port >= MIN_UDP_PORT || $port <= MAX_UDP_PORT ) { return FALSE; } } return TRUE; };
This functions does not seem to be referenced anywhere in your code. Additionally: Why do you code it as a sub reference instead of an actual function?
sub verify_port { ... };
inside verify_port you are using the wrong conditional
if ( $port >= MIN_UDP_PORT || $port <= MAX_UDP_PORT ) {
This will happily allow 10000000000 as a valid port. At the very least you should replace || with &&. I'm to lazy too look up operator precedence, but you may also need to replace && with 'and' or put the conditions into parenthesis.
either: if ( ($port >= MIN_UDP_PORT) && ($port <= MAX_UDP_PORT) ) { or: if ( $port >= MIN_UDP_PORT and $port <= MAX_UDP_PORT ) {

Resumee:

I would not want to touch this module with a ten-foot pole. I wasn't even looking very hard.


In reply to Re: RFC: Net::SNTP::Server v1 by Monk::Thomas
in thread RFC: Net::SNTP::Server 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.