I have an issue with import and inheritance that I cannot figure out. When a certain module of mine is loaded at runtime, it forces a chain of requires through the DBIx::SQLEngine distribution, leading to this error:
"new_group_from_values" is not exported by the
DBIx::SQLEngine::Criteria module
Can't continue after import errors at
/home/terry/perl/share/perl/5.8.7/DBIx/SQLEngine/RecordSet/Set.pm
line 318
BEGIN failed--compilation aborted at
/home/terry/perl/share/perl/5.8.7/DBIx/SQLEngine/RecordSet/Set.pm
line 318.
Compilation failed in require at
/home/terry/perl/share/perl/5.8.7/DBIx/SQLEngine/Record/Table.pm line
64.
Compilation failed in require at
/home/terry/perl/share/perl/5.8.7/Class/MixinFactory/Factory.pm line
55.
Compilation failed in require at
/var/www/terry/metaperl.org/Guestbook/App/sign_commit.pm line 7.
BEGIN failed--compilation aborted at
/var/www/terry/metaperl.org/Guestbook/App/sign_commit.pm line 7.
Compilation failed in require at
/var/www/terry/metaperl.org/Guestbook/App.pm line 17.
BEGIN failed--compilation aborted at
/var/www/terry/metaperl.org/Guestbook/App.pm line 17.
Compilation failed in require at Guestbook.cgi line 32.
BEGIN failed--compilation aborted at Guestbook.cgi line 32.

... and if you look at the file Criteria.pm you would not be surprised to see this import error because no such sub exists in this file:

However, I can run 2 separate static small scripts which emulate what is happening during the above chain of failed requires and they all work.

First, a script which loads Guestbook::Model::entry (the module whose require from Guestbook::App::sign_commit creates the error chain) and does a commit to database... it does the commit perfectly. entry.pl and entry.pm are here:

In other words, even though it loads Guestbook::Model::entry, it does not fail when loading the other modules in the DBIx::SQLEngine distribution.

Now, the last thing that happens before the "not exported" error is that Record/Table.pm does a require DBIx::SQLEngine::RecordSet::Set, so I wrote a script which only does that and it runs just fine:

So, the question becomes: why is it when CGI::Prototype::PathInfo does a dynamic require of Guestbook::App::sign_commit and then Guestbook::App::sign_commit does a use Guestbook::Model::entry that the above chain of errors is thrown? You can view PathInfo.pm here:


In reply to runtime load of DBIx::SQLEngine modules via CGI::Prototype::PathInfo fails but static cases work fine by metaperl

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.