Add this line, after the eval "use $package" statement. (Note: You did add a use strict and use English to your script right?).

warn "use error: " . $EVAL_ERROR . "\n";

It should complain twice about not being able to find the package. Once for each call. If you add a third call it would complain a third time, etc... Each eval statement is kinda slow. If there are a large enough transactions it can slow the system significantly.

What kyle was suggesting is spoofing the load in the %INC variable so I only have it complain once and eval once for a given package. Does that help?


In reply to Re^2: Dynamically creat Packages by Herkum
in thread Dynamically create Packages by Herkum

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.