Re: Bug in pixbuf->copy ?
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Bug in pixbuf->copy ?
- Date: Tue, 18 Apr 2006 17:47:29 +0200
On Tue, 2006-04-18 at 11:23 +0200, Jaap Karssenberg wrote:
use strict; #!!!
sub insert_image {
my ($textbuffer, $file) = @_;
my $pixbuf = Gtk2::Pixbuf->new_from_file($file) if -f $file and -r _;
$pixbuf ||= Gtk2::Image->new->render_icon('gtk-missing-image',
'dialog')->copy;
# ...
}
This is actually an undocumented and not future-proof way of getting
static variables. The "glitches" that make it work are described in
[1]. There was also an entry about this on of the p5p digests, but the
original site[2] doesn't seem to have it anymore -- probably to not
further publicize the trick. Anyway, the Google cache[3] still has it.
[1]
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-05/msg00736.html
[2] http://www.perl.com/pub/a/2000/05/p5pdigest/THISWEEK-20000521.html
[3]
http://66.249.93.104/search?q=cache:9KzmPF_kPn8J:www.perl.com/pub/2000/05/p5pdigest/THISWEEK-20000521.html+my+%22if+(0)%22&hl=en&ct=clnk&cd=4
--
Bye,
-Torsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]