Global symbol "%Config" requires explicit package at at C:/Perl/lib/Time/Local .pm line 27.

Discussion in 'Perl Misc' started by charlieskc@gmail.com, Jan 28, 2005.

  1. Guest

    Hi all,

    I am try to test my perl script, with just a few line:

    use Time::Local 'timelocal_nocheck'; {
    # The 365th day of 1999
    print scalar localtime timelocal_nocheck 0,0,0,365,0,99;

    }

    but when I compile, it prompts error that "Global symbol "%Config"
    requires explicit package at at C:/Perl/lib/Time/Local.pm line 27."

    in C:/Perl/lib/Time/Local.pm line 27: my $MaxInt = ((1<<(8 *
    $Config{intsize} - 2))-1)*2 + 1;

    I think I set something wrong in the environment setting, could you
    please figure out why I have such error occur? many thanks!!!
    Regards,
    Charlie
    , Jan 28, 2005
    #1
    1. Advertising

  2. "" <> wrote in
    news::

    > I am try to test my perl script, with just a few line:
    >
    > use Time::Local 'timelocal_nocheck'; {
    > # The 365th day of 1999
    > print scalar localtime timelocal_nocheck 0,0,0,365,0,99;
    >
    > }


    That runs perfectly fine on my system. I don't think you posted the
    complete script. Please read the posting guidelines for
    comp.lang.perl.misc.

    > but when I compile, it prompts error that "Global symbol "%Config"
    > requires explicit package at at C:/Perl/lib/Time/Local.pm line 27."
    >
    > in C:/Perl/lib/Time/Local.pm line 27: my $MaxInt = ((1<<(8 *
    > $Config{intsize} - 2))-1)*2 + 1;
    >
    > I think I set something wrong in the environment setting, could you
    > please figure out why I have such error occur? many thanks!!!


    I suspect you have a custom Config.pm in your @INC that is found before
    the Perl Config.pm. Don't do that. But then, I am not a mindreader and
    it is fairly difficult to correctly diagnose a problem without seeing
    real code.

    Sinan.
    A. Sinan Unur, Jan 28, 2005
    #2
    1. Advertising

  3. Guest

    This is the complete script indeed. however I do have another script
    called config.pm, but perl is case sensitive so I think it is different
    from the Config.pm right?
    , Jan 28, 2005
    #3
  4. wrote:

    > This is the complete script indeed. however I do have another script
    > called config.pm, but perl is case sensitive


    Perl is case-sensitive, but the Windows file system is not.

    If you do a 'use config' on a system with a case-insensitive file system,
    then Config.pm will load and parse just fine. But, then Perl will look for
    config->import(), and obviously it won't find it. So no functions or
    constants get imported from the module.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Jan 28, 2005
    #4
  5. Re: Global symbol "%Config" requires explicit package at at C:/Perl/lib/Time/Local.pm line 27.

    Sherm Pendley wrote:

    > wrote:
    >
    >
    >>This is the complete script indeed. however I do have another script
    >>called config.pm, but perl is case sensitive

    >
    >
    > Perl is case-sensitive, but the Windows file system is not.
    >
    > If you do a 'use config' on a system with a case-insensitive file system,
    > then Config.pm will load and parse just fine. But, then Perl will look for
    > config->import(), and obviously it won't find it. So no functions or
    > constants get imported from the module.


    True but this is not what is happening to the OP.

    If you have your own module called config earlier in the @INC search
    path then any module trying to load the standard Config module will fail.
    Brian McCauley, Jan 28, 2005
    #5
  6. Brian McCauley wrote:

    > Sherm Pendley wrote:
    >
    >> Perl is case-sensitive, but the Windows file system is not.
    >>
    >> If you do a 'use config' on a system with a case-insensitive file system,
    >> then Config.pm will load and parse just fine. But, then Perl will look
    >> for config->import(), and obviously it won't find it. So no functions or
    >> constants get imported from the module.

    >
    > True but this is not what is happening to the OP.


    The example file names were reversed - he's trying to load Config.pm and
    getting config.pm instead, not the other way 'round - but otherwise that's
    exactly what is happening.

    The point is that the Windows file system is not case sensitive, whereas
    package names are. Whichever way you look at it, it's that impedance
    mismatch which is the cause of the problem.

    sherm--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
    Sherm Pendley, Jan 28, 2005
    #6
    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. xxx
    Replies:
    0
    Views:
    809
  2. snowdog
    Replies:
    2
    Views:
    363
    Joe Smith
    Nov 7, 2004
  3. sam

    requires explicit package name

    sam, Jan 6, 2005, in forum: Perl Misc
    Replies:
    4
    Views:
    232
    Tad McClellan
    Jan 12, 2005
  4. mike
    Replies:
    3
    Views:
    654
    Dr.Ruud
    Apr 30, 2008
  5. Replies:
    6
    Views:
    1,726
Loading...

Share This Page