delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/16/16:25:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Andrew DeFaria <Andrew AT DeFaria DOT com>
Subject: Re: Problem with Perl/Tk and Pixmap
Date: Thu, 16 Dec 2010 16:25:17 -0500
Lines: 96
Message-ID: <iee03u$980$1@dough.gmane.org>
References: <20101216190751 DOT GA3017 AT ford DOT loewis DOT de>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9pre) Gecko/20100821 Lightning/1.0b2 Lanikai/3.1.3pre
In-Reply-To: <20101216190751.GA3017@ford.loewis.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

  On 12/16/2010 02:07 PM, Johannes v. Löwis wrote:
> I have a Perl/Tk script that is supposed to show a pixmap on the left
> side of the title bar of the main window. It works on Linux and on a
> rather old version of Cygwin 1.5.
> On Cygwin 1.7 (on XP Home and Prof) the following happens:
>
> $ ./logotest.pl
> Can't bless non-reference value at /usr/lib/perl5/vendor_perl/5.10/i686-cygwin/Tk/Image.pm line 23.
>
> $ cat logotest.pl
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Tk;
>
> my $mw = new MainWindow;
> my $icon = '/* XPM */
> static char *Camel[] = {
> /* width height num_colors chars_per_pixel */
> "    32    32        2            1",
> /* colors */
> ". c #ffffff",
> "# c #7f7f00",
> /* pixels */
> "................................",
> "................................",
> "...................###..........",
> ".......####......######.........",
> "....####.##.....########........",
> "....########....#########.......",
> "......######..###########.......",
> "......#####..#############......",
> ".....######.##############......",
> ".....######.###############.....",
> ".....######################.....",
> ".....#######################....",
> ".....#######################....",
> "......#######################...",
> ".......####################.#...",
> "........###################.#...",
> "........###############.###.#...",
> "............#######.###.###.#...",
> "............###.###.##...##.....",
> "............###.###..#...##.....",
> "............##.####..#....#.....",
> "............##.###...#....#.....",
> "............##.##...#.....#.....",
> "............#...#...#.....#.....",
> "............#....#..#.....#.....",
> "............#.....#.#.....#.....",
> "............#.....###.....#.....",
> "...........##....##.#....#......",
> "...........#..............#.....",
> ".........###.............#......"
> "................................",
> "................................",
> };';
>
> $mw->Pixmap('logo', -data=>$icon);
> $mw->iconimage('logo');
> MainLoop;
>
> $ uname -a
> CYGWIN_NT-5.1 user-e90cadfdc0 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin
>
>
> Any ideas or suggestions what further information I could provide
> in order to sort this out?
>
Reproduced. Note you problem appears to be with Tk::Image, not with 
Cygwin, though you are right in that it works on Linux and complains and 
dies on Cygwin.

Interestingly, if you run your program and the Perl debugger (i.e. perl 
-d logtest.pl) then simply type c for continue it works fine.

Looking at Image.pm I see that if I break at Image.pm:23 there's a 
"return bless $obj,$package" statement. In the debugger, $obj is defined 
and there's no problem. If, however, I just run this without the 
debugger, but put some print statements in Image.pm, I see that $obj is 
indeed returned from $widget->Tk::image as undefined.

This appears to be a Perl/Tk bug.

Even stranger! Change your

   $mw->Pixmap('logo', -data=>$icon);

to

   my $foo $mw->Pixmap('logo', -data=>$icon);

and it works! So you have  a work around, and a bug to report.
-- 
Andrew DeFaria <http://defaria.com>
This is as bad as it can get, but don't bet on it.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019