Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error searching @INC

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Joined
Feb 6, 2002
Messages
1,851
Location
IL
HI,
The following code works ok when run as .pl,but fails after converting to .exe using the "pp" :
===============================
use warnings;
use strict;
use diagnostics;
use lib "D:/Perl/site/lib/
use
my $query = 'postscript';
my $search = new while (1) {
sleep 2;
$search->native_query( { type => 'who' });
while (my $result = $search->next_result()) {
print $result->url, "\n";
print $result,"\n";
}
}
=======================================
error :

Uncaught exception from user code:
unknown search engine backend Yahoo (Can't locate in @INC (@INC con
tains: CODE(0x1241ed0) C:\DOCUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180420622/inc/lib C:\DO
CUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180420622/inc CODE(0x109f6d4) . CODE(0x109f7f4)) at
(eval 19) line 2.
BEGIN failed--compilation aborted at (eval 19) line 2.
) at script/getFiles1.pl line 10
at -e line 877
==============================

I do have Yahoo.pm in D:/Perl/site/lib/ is properly installed.

Will appreciate ideas.
Thanks



Long live king Moshiach !
 
I do not know about the particulars of compiling perl, however your use lib statement is actually incorrect. It should be:

Code:
[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]lib[/green] [red]'[/red][purple]D:/Perl/site/lib/[/purple][red]'[/red][red];[/red]
[tt]------------------------------------------------------------
Pragmas (perl 5.8.8) used :
[ul]
[li]lib - Manipulate @INC at compile time[/li]
[/ul]
[/tt]

- Miller
 
Did you add the use lib for the fun of it or to try and get pp to compile it correctly?
 
HI,

I have added the "lib" line in order to solve the @INC error.

Now the code is:

use lib 'D:/Perl/site/lib/';
or
use lib 'D:/Perl/site/lib/
(Yahoo.pm resides in the second path)

and the error still is :

Uncaught exception from user code:
unknown search engine backend Yahoo (Can't locate in @INC (@INC con
tains: CODE(0x12404a0) C:\DOCUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180425238/inc/lib C:\DO
CUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180425238/inc CODE(0x109f534) . CODE(0x109f654)) at
(eval 19) line 2.
BEGIN failed--compilation aborted at (eval 19) line 2.
) at script/getFiles1.pl line 10
at -e line 877



Long live king Moshiach !
 
Okay, just a real quick note about module names and paths:

Translate :: into / and tack on a .pm, so that becomes
Thus, by doing
Code:
use lib 'D:/Perl/site/lib/[URL unfurl="true"]WWW/Search/';[/URL]
use WWW::Search::Yahoo;

Perl will search for (among other paths), a file existing at "D:/Perl/site/lib/WWW/Search/WWW/Search/Yahoo.pm

Thus,
Code:
use lib 'D:/Perl/site/lib';
use WWW::Search::Yahoo;

Perl will look for that module in "D:/Perl/site/lib/WWW/Search/Yahoo.pm and find it.

On a site note, /Perl/site/lib should already be in your @INC, try printing out @INC,
Code:
print join ("\n",@INC);

If that path is indeed already in @INC, and you're sure the module is there, then you may have a different problem altogether.

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
he has something else going on too, what is with the code reference in the path?

@INC contains: CODE(0x12404a0)


surely that is going to confuse things unless that is normal for perl scripts converted to exe using pp.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Looking back at his code, I have a theory:

Code:
use [URL unfurl="true"]WWW::Search;[/URL]

my $query = 'postscript';
my $search = new WWW::Search('Yahoo');

Since he didn't explicitely say "use pp didn't pick up that dependency. I'm assuming that dynamically includes new modules when you make the call to new()

So, when you build your code with pp, use the command-line flag to include or just put a "use" statement for it in your code.

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
On another note, pp doesn't honor "use lib", so you'd have to manually include external libs... i.e. I have a program that does use lib "./lib", but when I compile it I gotta do this:

Code:
pp -I ./lib -o PCCC.exe PCCC.pl

And then it goes into ./lib to include modules within inside the executable.

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
HI,

Thanks for the replies.

pp -I "D:/Perl/site/lib/ -o getfiles1.exe getFiles1.pl

D:\DOcuments\myscripts>getfiles1.exe

Uncaught exception from user code:
unknown search engine backend Yahoo (Can't locate in @INC (@INC con
tains: CODE(0x12404a0) C:\DOCUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180502756/inc/lib C:\DO
CUME~1\26842\LOCALS~1\Temp\par-26842\cache-1180502756/inc CODE(0x109f534) . CODE(0x109f654)) at
(eval 19) line 2.
BEGIN failed--compilation aborted at (eval 19) line 2.
) at script/getFiles1.pl line 10
at -e line 877

====================
The code that does not produce errors is :

use warnings;
use strict;
use diagnostics;
#use lib 'D:/Perl/site/lib/use lib 'D:/Perl/site/lib/';

use
my $query = 'postscript';
my $search = new while (1) {
print STDOUT "Running ...\n";
sleep 1;
$search->native_query( { type => 'who' });
while (my $result = $search->next_result()) {
print $result->url, "\n";
print $result,"\n";
}
}
==================
But this code produces no serach results either ...

Long live king Moshiach !
 
Code:
pp -I "D:/Perl/site/lib/[URL unfurl="true"]WWW/Search"[/URL] -o getfiles1.exe getFiles1.pl

NO

Code:
pp -I "D:/Perl/site/lib" -o getfiles1.exe getFiles1.pl

becomes / so all you need is the base path to your Perl libs. -_-

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top