I think it was perl 5.16 where they removed current-dir from @INC. It was less about CGI scripts and more about commandline scripts installed in PATH, where someone could run that command from any directory and get a module pulled in from the current directory by accident (or malice).

As others have mentioned, you set yourself up for security problems when you put modules alongside your cgi scripts. By default, apache will serve up the contents of your .pm files and let the world look at your code. Even if you add apache configs to block serving your modules, Apache also makes it easy to accidentally reconfigure things in a subdirectory so that suddenly they are visible again. You need to either be really careful with your apache config (now, and in the future), or move your perl modules (and config files and any resource data files) to a different directory that is not being served by apache.

Also beware of serving your .git/ directory by accident, if you are doing all your work in the cgi-bin dir.

Also, since you're not following Perl, I'll mention that the latest releases of Perl don't include the CGI module by default anymore, because it has other foot-guns that cause security problems, like calling ->params(...) in list context. If you upgrade your server in the future you might need to install it (either via OS package manager, or via cpanm) The current recommended practices are to use web frameworks like Mojo or Catalyst, but that would be overkill if you just have a few simple scripts you want to keep working. There are also minimalist launched-from-apache replacements like CGI::Tiny or Plack::Handler::CGI + Web::Simple


In reply to Re^5: Why is my PM package failing? by NERDVANA
in thread Why is my PM package failing? by SergioQ

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.