Something like ten years ago, I wrote a RADIUS authentication server in Perl. The RADIUS protocol involves sending blocks of binary data in UDP packets.

My skills being what they were ten years ago, I lived in constant fear that my carefully crafted numbers and strings would be converted from one to the other behind my back. I've sadly forgotten the details of this ordeal, but I've carried the "don't write a binary protocol handler in Perl" scars around with me ever since.

As I think about it now, if I were writing it today, I don't think I'd have much problem. I'd make a RADIUS packet object to abstract away all kinds of headaches. I still would have to study pack and unpack a while before I got it right, but I'd do a lot of testing to help guide my way.


In reply to Re: Don't Write That In Perl! by kyle
in thread Don't Write That In Perl! by Ovid

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.