Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Graham Wood
August 16, 2004, 7:32 pm
rate this thread
managed to get the program to work by scoping the $ftp object with "our"
but I don't think this is how you are supposed to do it.
Here's an artist's impression of what I'm doing now:
our $ftp= Net::FTP->new("hostname")|| die "Can't create FTP object";
# get $path from value in a text box
I know that I could pass the $ftp object as an argument to subroutines
if I were calling them from my script but in this event driven model,
how do I elegantly pick up the value of the existing ftp object without
letting it all hang out in this unseemly fashion?
I notice that the gui $win object is picked up with code like this:
defined(my $win = $Win32::GUI::Loft::window(winCopyFiles})
or return (1);
Can I do something similar with Net::FTP objects like
defined(my $ftp = $Net::FTP);
Any hints gratefully accepted.
Re: How do I pick up existing objects in event handling code?
> defined(my $win = $Win32::GUI::Loft::window(winCopyFiles})
> or return (1);
> Can I do something similar with Net::FTP objects like
> defined(my $ftp = $Net::FTP);
Yes, you can attach an object to the Win32::GUI::Loft::Design object
you created when loading the design from the .gld file. The property
is called objApp:
Some user-defined object, normally used to connect a
application object responsible for this window.
So if you assign your FTP object (or any object) to the Design like
this (untested code):
my $objDesign = Win32::GUI::Loft::Design->newLoad($fileWindow); #or
then you can get it out of the object in the event handlers like this:
my ($win, $design, $ftp) = tglApp('yourWindowName) or die;
Something like that.
I happened to stumble across this post by accident. There is a support
mailing list at the TGL site which I at least read a bit more often: