Re: Bug in pixbuf->copy ?
- From: Thierry Vignaud <tvignaud mandriva com>
- To: Torsten Schoenfeld <kaffeetisch gmx de>
- Cc: gtk-perl-list gnome org
- Subject: Re: Bug in pixbuf->copy ?
- Date: Tue, 18 Apr 2006 19:36:48 +0200
Torsten Schoenfeld <kaffeetisch gmx de> writes:
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.
well, until state variables are availlable (perl-5.9.x ???), that's
the only way to have static variables, that do be usefull in some
cases.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]