perlquestion
luisfagundes
Hi Monks!<br>
I'm right on a deadline and everything was working perfect. Then I made some comments, put use strict in all modules and one 'my' that was missing to compile with strict and when trying to compile, I got this:<br>
<br>
Unknown error<br>
Compilation failed in require at BookRetriever.pm line 8.<br>
BEGIN failed--compilation aborted at BookRetriever.pm line 8.<br>
Compilation failed in require at compare_prices.pl line 4.<br>
BEGIN failed--compilation aborted at compare_prices.pl line 4.<br>
<br>
These are the first lines of BookRetriever:<br>
<br>
<code>package BookRetriever;
####################################################
# This class uses Vendor plugins to retrieve book HTML pages from vendor websites,
# parse them, insert it into db and return data from db
use DBI;
use LWP::UserAgent;
use Vendor::Amazon; # LINE 8
use Vendor::BarnesNoble;
# Here is configuration for everything
our %CONFIG = ('db_host' => 'localhost',
'db_name' => 'books',
'db_user' => 'user',
'db_pass' => 'pass',
'html_retrieve_timeout' => 30,
'vendors' => [ qw(Amazon BarnesNoble) ]
);
</code>
error line is this use Vendor::Amazon, and error happens Vendor::BarnesNobles if I exchange them. In fact, I made one change right there. It was working, them I erased these two lines, put a BEGIN around our %CONFIG and inside the BEGIN I looped through @{$CONFIG{'vendors'}} and eval "use Vendor::$vendor;";<br>
I kept writing comments all around before testing then noticed the eval didn't work, when I got back the old way it didn't compile<br>
Any ideas?
<sub><p>janitored by [ybiC]: Balanced <code> tags around codeblock, renamed from "<i>Unknown compile error - desperation</i>"</p></sub>