there is giant reason i use prototypes. but, i would like to know WHY it's such a giant deal that i do.

Please see Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen. Just to briefly name a few issues, Prototypes do much more than just check how many arguments are passed to a function, they also affect how Perl code is parsed and how arguments are passed to functions (e.g. arrays are magically turned into arrayrefs where normally they would get flattened). If you have "lots of subs in many different modules", can you recall what the prototype of each and every one is? How about someone else using your code, or a future maintainer, will they be surprised at how their code gets parsed? Plus, just call a sub as &foo(...) and the prototype is ignored, and they're also not used for method calls.

Note I'm not saying you shouldn't ever use them. But they're not really meant as a "check the number of arguments passed to a sub" feature, for that you've got @_==3 or croak "bad number of args to X", modules like Params::Validate, or even the experimental Signatures. Prototypes are best for functions that extend the Perl syntax (e.g. the way Try::Tiny does it), and if you do use them, you should be aware of all of the issues.


In reply to Re^4: perl and apache2 on ubuntu 17.04 by haukex
in thread perl and apache2 on ubuntu 17.04 by jamroll

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.