Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Adding PerlTk

by perl_pilgrim (Novice)
on Sep 06, 2003 at 22:47 UTC ( [id://289515]=perlquestion: print w/replies, xml ) Need Help??

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

I am trying to add PerlTk to Perl 5.8.0 on a system running RH9.0. Following install I am running a simple PerlTk program . But I get :
Can't locate loadable object for module Tk in @INC BEGIN failed--compilation aborted at perltk1.pl line 7.
line 7 is ... use Tk; I suspect I need to change a path and @INC is the key. Can someone help me find the mysterious @INC ?

Replies are listed 'Best First'.
Re: Adding PerlTk
by bobn (Chaplain) on Sep 06, 2003 at 23:13 UTC

    This one-liner will give you contents of @INC:

    perl -le 'print $_ for @INC'

    But usually that error message includes the paths in @INC. And usually, the install process uses that information to put stuff in the right place. Is there any chance you had more than on version of perl floating around?

    Are you sure your install worked?

    I'm running perl on rh9 with Tk, no problem. I do recall that I had to muck with something to make the install work though, if you search for perl, Tk and utf8 or utf-8, I think tyou'll find it.

    Update: I found references to this by googling about: for

    perl tk "red hat 9" LANG
    in the Groups search. The resulting URL is too long to reasonably post here, beut here is an excerpt:
    This is due to the screwed up string handling of Perl in unicode. You can
    disable unicode by setting
    
    export LANG="en_US"
    
    first (just type this command before doing perl Makefile.PL )
    
    "

    On my system, it appears that I have unset LANG - I may have actually tracked down where it was being set, I don't remember anymore.

    --Bob Niederman, http://bob-n.com

    All code given here is UNTESTED unless otherwise stated.

      You don't have to set LANG anymore if you're going to use Perl 5.8.1. From Perl 5.8.1's perldelta:

      UTF-8 no longer default under UTF-8 locales
      In Perl 5.8.0 many Unicode features were introduced. One of them was found to be of more nuisance than benefit: the automagic (and silent) "UTF-8-ification" of filehandles, including the standard filehandles, if the user's locale settings indicated use of UTF-8.

      For example, if you had C<en_US.UTF-8> as your locale, your STDIN and STDOUT were automatically "UTF-8", in other words an implicit binmode(..., ":utf8") was made. This meant that trying to print, say, chr(0xff), ended up printing the bytes 0xc3 0xbf. Hardly what you had in mind unless you were aware of this feature of Perl 5.8.0. The problem is that the vast majority of people weren't: for example in RedHat releases 8 and 9 the B<default> locale setting is UTF-8, so all RedHat users got UTF-8 filehandles, whether they wanted it or not. The pain was intensified by the Unicode implementation of Perl 5.8.0 (still) having nasty bugs, especially related to the use of s/// and tr///. (Bugs that have been fixed in 5.8.1)

      Therefore a decision was made to backtrack the feature and change it from implicit silent default to explicit conscious option. The new Perl command line option C<-C> and its counterpart environment variable PERL_UNICODE can now be used to control how Perl and Unicode interact at interfaces like I/O and for example the command line arguments. See L<perlrun> for more information.

      Liz

      Thank you Bob !

      As expected Tk is not included in the @INC.
      perl -le 'print $_ for @INC' /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0

      And in this case I have a situation. I need Unicode enabled because I am coding some pages in Vietnamese.

      In my own searches I found a few people with the same issue in adding Tk. And I was hoping for a surgical way to add the Tk directory to the search path, but if Unicode is the issue ... then that is a whole new problem.

        You wouldn't typically see the module in the contents of @INC. @INC lists directories where the search for modules start.

        I don;t know whether utf-8 has to be turned off all the time or only during the build process - I think the latter, but judging from Liz's post below, you are better of just going for perl 5.8.1.

        --Bob Niederman, http://bob-n.com

        All code given here is UNTESTED unless otherwise stated.

Re: Adding PerlTk
by blogan (Monk) on Sep 07, 2003 at 22:55 UTC
    You shouldn't need to change a path, you should install Tk into an existing directory in @INC. How did you install Perl Tk?
      Wow,

      Thanks for all the help everyone.

      And I installed what I thought was an RH9 compatible rpm ... PerlTk-8.11-1.i386.rpm.

      If I should burn this down, & start over with known good downloads, can you direct me to the right links eg. the Perl 8.5.1 mentioned previously ... just so I am on the same page with everyone else.

      Thanks Again Monks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-12-08 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (50 votes). Check out past polls.