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

Discussion in 'Perl Misc' started by david, Jan 28, 2009.

  1. david

    david Guest

    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
    david, Jan 28, 2009
    #1
    1. Advertising

  2. david

    Guest

    On Wed, 28 Jan 2009 00:06:36 -0800 (PST), david <> wrote:

    >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
    , Jan 28, 2009
    #2
    1. Advertising

  3. david

    Guest

    >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.
    , Jan 29, 2009
    #3
  4. david

    david Guest

    On Jan 29, 1:06 pm, ""
    <> wrote:
    > >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.


    cool idea.
    This works
    david, Jan 29, 2009
    #4
  5. <> wrote:
    >>How can i solve the problem ?

    >
    > 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;


    > require Memoize;
    > Memoize->import('memoize');
    > }
    >
    > This would prevent searching for modules (Config.pm) in current folder.



    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
    Tad J McClellan, Jan 29, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bGVueWFkbw==?=
    Replies:
    2
    Views:
    410
    =?Utf-8?B?bGVueWFkbw==?=
    May 20, 2005
  2. Chris Reedy

    How to memoize functions?

    Chris Reedy, Jun 26, 2003, in forum: Python
    Replies:
    3
    Views:
    989
    Chris Reedy
    Jun 27, 2003
  3. Replies:
    0
    Views:
    651
  4. Replies:
    2
    Views:
    763
  5. samwyse
    Replies:
    2
    Views:
    92
Loading...

Share This Page