Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Perl @INC error

by merrymonk (Hermit)
on May 09, 2007 at 14:44 UTC ( [id://614402]=perlquestion: print w/replies, xml ) Need Help??

merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

I am having trouble getting Perl to run another PC.
As I have done many times before, I loaded the Perl directory and its sub-directories on
to the C drive. I then tried to run a very simple Tk example. This gave the following error
hello-world-tk.pl Can't locate Tk.pm in @INC (@INC contains: CODE(0xc1c15c) .)
It works if the example just contains a print statement.
When I print the contents of @INC I get what is shown in the error message
(no surprise there) rather than the two Perl library directories
Can anyone tell me what is going wrong and how to cure it?

Replies are listed 'Best First'.
Re: Perl @INC error
by GrandFather (Saint) on May 09, 2007 at 20:39 UTC

    What do you get when you run:

    use warnings; use strict; print "Perl version: ", join ('.', unpack('C3', $^V)), "\n"; print "* $_\n" for @INC; require Tk; print "~ $_\n" for @INC;

    What OS are you using (XP seems likely).


    DWIM is Perl's answer to Gödel
      C:\>perl -e die$] 5.008007 at -e line 1.
      I get exaclty the same as in the error message, that is
      CODE(0xc1c15c). I am using XP.

        On two different computers running XP I get:

        Perl version: 5.8.8 * C:\Program Files\ActiveState Komodo 3.5\lib\support\dbgp\perllib * C:\Program Files\ActiveState Komodo 3.5\lib\support\dbgp\perllib * C:/Perl/site/lib * C:/Perl/lib * . ~ C:\Program Files\ActiveState Komodo 3.5\lib\support\dbgp\perllib ~ C:\Program Files\ActiveState Komodo 3.5\lib\support\dbgp\perllib ~ C:/Perl/site/lib ~ C:/Perl/lib ~ .

        Try uninstalling Tk and then reinstalling it.

        Note, I wasn't interested in the error message as such, we already had that information. I was more interested in confirming that the include path was sensible before Tk is loaded and trashed afterwards. You haven't actually confirmed that yet.


        DWIM is Perl's answer to Gödel
Re: Perl @INC error
by robot_tourist (Hermit) on May 09, 2007 at 15:03 UTC

    Can you show us exactly what statements you have that assign something to @INC?

    @INC should at least contain the location of your Perl installation without you doing anything to it and in most cases that should include Tk.

    Another possibility is that you haven't done use Tk correctly. Again, we'd need to see what you've written to be sure.

    How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
    Robot Tourist, by Ten Benson

      I have not written anything to load data into the @INC
      array (in fact I have never done this).
      Neither have done anything that I know of assciated with Tk.

        But what does your actual code say? Is it something like this?

        use strict; use warnings; use Tk; my $top = new MainWindow; MainLoop;

        How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
        Robot Tourist, by Ten Benson

Re: Perl @INC error
by Moron (Curate) on May 09, 2007 at 15:52 UTC
    Tk is not a core module, so it needs to be installed on top of the installation, see How do I install a module from CPAN?
    __________________________________________________________________________________

    ^M Free your mind!

      Re-read the posting. He's not asking how to use Tk;, he's asking why his @INC seems to contain a reference to a sub (as shown in the messages as CODE(0xDEADBEEF)) instead of the usual list of strings that refer to various directories.

      --
      [ e d @ h a l l e y . c c ]

Re: Perl @INC error
by Anonymous Monk on May 10, 2007 at 04:04 UTC
    So you're using PAR?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://614402]
Approved by varian
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2025-03-16 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.