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

Hi, I've installed perl-tk on my debian system. A co-worker did the same install. He successfully runs the program below, but I get the results listed below. It looks to me like perl-tk is munging its paths to the font directories, but that may just be a by product of a different problem. There's nothing particularly exotic about my system. I'm stumped...anybody have any ideas? bigtiny the script:
#!/usr/bin/perl use Tk; my $mw = MainWindow->new; $mw->Label( -text => "foo" )->pack; $mw->Button( -text => "bar", -font => "times", -command => sub { exit +} )->pack; MainLoop;
result:
Tcl_GetStringFromObj @ 535 not utf8 SV = PV(0x88074ac) at 0x880f150 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x880ffd8 "font \"\230\377\200\10etica -12 bold\" doesn't exist +"\0Malformed UTF-8 character (overflow at 0x74a63860, byte 0x2d, afte +r start byte 0xff) in subroutine entry at /usr/local/lib/perl/5.8.4/T +k/Widget.pm line 190. [UTF8 "font "\x{63f}\x{0}bold" doesn't exist"] CUR = 39 LEN = 40 SV = PVMG(0x880a848) at 0x880f150 REFCNT = 1 FLAGS = (SMG,POK,pPOK,UTF8) IV = 0 NV = 0 PV = 0x880ffd8 "font \"\230\377\200\10etica -12 bold\" doesn't exist +"\0Malformed UTF-8 character (overflow at 0x74a63860, byte 0x2d, afte +r start byte 0xff) in subroutine entry at /usr/local/lib/perl/5.8.4/T +k/Widget.pm line 190. [UTF8 "font "\x{63f}\x{0}bold" doesn't exist"] CUR = 39 LEN = 40 MAGIC = 0x8810060 MG_VIRTUAL = &PL_vtbl_utf8 MG_TYPE = PERL_MAGIC_utf8(w) MG_LEN = 27 font "??etica -12 bold" doesn't exist at /usr/local/lib/perl/5.8.4/Tk/ +Widget.pm line 190. at ./test.pl line 19 Tk::Widget::new('Tk::Label', 'MainWindow=HASH(0x87f2c8c)', '-t +ext', 'foo') called at /usr/local/lib/perl/5.8.4/Tk/Widget.pm line 25 +6 Tk::Widget::__ANON__('MainWindow=HASH(0x87f2c8c)', '-text', 'f +oo') called at ./test.pl line 19 at ./test.pl line 19

Replies are listed 'Best First'.
Re: Weirdness getting perl-tk to work
by GrandFather (Saint) on Sep 20, 2006 at 20:52 UTC

    Check that both Perl builds are the same and that you are using the same version of Tk. On Windows at least missing fonts simply cause a fall back to the default font and no error message.


    DWIM is Perl's answer to Gödel
Re: Weirdness getting perl-tk to work
by Animator (Hermit) on Sep 20, 2006 at 20:58 UTC

    Can you check the environment?

    Also, how did you transfer the script? Did you transfer it in ASCII mode?

    It looks like the script is having problems with some UTF-8 characters but there aren't any (or atleast not that I can see)... So either the script is created/transfered incorrectly or the environment is wrong...

    I guess you could also try by adding use utf8; at the top of the code.