help sharing Tk::Photo object
[email protected] (Brent Baccala)
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <[email protected]> |
Hello, I'm having problems writing my first ithreads program. I need a Tk::Photo object shared between threads. The idea is to load images in background while the GUI keeps running. Can it be done? As soon as I do a &share($fimage), I can no longer do anything useful with $fimage. I get complaints like: Use of uninitialized value in subroutine entry at /usr/lib/perl5/Tk/Submethods.pm line 37. image "" doesn't exist at /usr/lib/perl5/Tk/Submethods.pm line 37. $fimage is a blessed object reference. I'm running a pretty stock Debian "edge" system, Perl 5.8.8. Here's a test program that shows my pain. Usage is "program imagefile". Thank you for any help you can give. #!/usr/bin/perl -w use strict; use Tk; use Tk::JPEG; use threads; use threads::shared; my $file = shift; my $mw = MainWindow->new(); my $fimage = $mw->Photo(-file => $file); # THIS MAKES ALL THE DIFFERENCE # &share($fimage); print $fimage->width, "\n"; -bwb Brent Baccala [email protected]