A few points:

  1. 'use' instead of 'require'. Then the inclusion is done at compile time and the subs can be found early by the compiler.
  2. use warnings; That will tell you what's not to like. In older Perl, make that '-w' on the shebang line.
  3. use strict; If you don't actually declare that, it can't tell you what's wrong.
  4. You have globals in the library, and making them lexical does not improve matters. The place to deal with an instance variable like $user is in the main script, where it should be lexical. If you truly have global parameters, consider use constant ADMIN => 'admin';
  5. At the top of your library, just say package Site::common; and save it as 'Site/common.pm'. No OO needed it can just be a bag of subroutines.
I recommend perlmod, perlsec, and perlvar.

Update: crazyinsomniac reminds me that warnings may also be turned on by $^W=1;.

After Compline,
Zaxo


In reply to Re: strict and declare subroutine argument number and order by Zaxo
in thread strict and declare subroutine argument number and order by nlafferty

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.