problem using memoize in folder where a module Config.pm is

D

david

HI all,

I've encountered a strange thing.

I want to use Memoize from a module in a folder where a Module
Config.pm is and it tells me the following error Global symbol
"%Config" requires explicit package name at /exlibris/sfx_ver/
sfx_version_3/app/perl-5.10.0/lib/5.10.0/Memoize.pm line 74.
I see that Memoize also uses the Config module. When using Memoize
from any other folder it works perfect.
I can not change the name of the Config module since it is used in
many places.

How can i solve the problem ?

Thanks,
David
 
S

sln

HI all,

I've encountered a strange thing.

I want to use Memoize from a module in a folder where a Module
Config.pm is and it tells me the following error Global symbol
"%Config" requires explicit package name at /exlibris/sfx_ver/
sfx_version_3/app/perl-5.10.0/lib/5.10.0/Memoize.pm line 74.

This line is too long to debug, too complicated, the path to the
..pm makes it sound like its from outer space.

"requires explicit package name" - check if its declard in the scope
of the block. Or, check errors before this one which is giving false
positives.

sln
 
S

sergey.aleynikov

How can i solve the problem ?

try changing "use Memoize;" with following:

BEGIN{
local @INC = grep { $_ !~ /^\./ } @INC;
require Memoize;
Memoize->import('memoize');
}

This would prevent searching for modules (Config.pm) in current folder.
 
D

david

try changing "use Memoize;" with following:

BEGIN{
 local @INC = grep { $_ !~ /^\./ } @INC;
 require Memoize;
 Memoize->import('memoize');

}

This would prevent searching for modules (Config.pm) in current folder.

cool idea.
This works
 
T

Tad J McClellan

try changing "use Memoize;" with following:

BEGIN{
local @INC = grep { $_ !~ /^\./ } @INC;


There may be babies in that bathwater.

If you want to elimnate only the current directory, then eliminate
only the current directory:

local @INC = grep { $_ ne '.' } @INC;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top