Thanks all for the input.
crashtest, i use:
use FindBin; use lib "$FindBin::Bin/PathWithModulesOfMyApp";
so i don't need to have "/" or "\" in $op, that's why the regexp is so strict. The reason to ask, is that imho "require" makes a BIG securiry issue, when the regexp is missing, you'd be able to do things like this
http://127.0.0.1/cgi-bin/script.pl?option=%60touch%20/tmp/HA_I_CAN_WRI +TE_ON_YOUR_HARDDISK.txt%60
and think of more nasty things to do.
That's what Tanktalus warns about, and that's why i'm wondering if there is a way to avoid the use of eval totally.
I'll have a look at UNIVERSAL::require and Class::Inspector as well, more options are welcome.

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

In reply to Re: better ways than eval to dynamic load a module by jbrugger
in thread better ways than eval to dynamic load a module by jbrugger

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.