G
Gareth Curtis
Hi all,
I wonder if someone can give me some advice.
I am using WxWindows with Perl and have a script with many different
packages. I'd like each of these packages to be able to write to a socket.
In the main.pl file I have:
my $socket_handle = connect_server();
Then each package is able to see the global variable, I assume this is ok.
The connect_server is a module containing the code to connect to the
server using the Socket.pm module. I struggled with this for ages and
finally worked out that the socket is actually a kind of file and to
return() a file I had to do this:
my $socket_handle = *SOCKET_HANDLE; # Set the $socket_handle variable to
the SOCKET_HANDLE (pass file type handle with *)
return($socket_handle);
This seems to work. My question is; is this the right way to do this? Or
will it cause problems later maybe? If not, what is the correct way to do
this.
Many thanks for any help,
Gareth.
I wonder if someone can give me some advice.
I am using WxWindows with Perl and have a script with many different
packages. I'd like each of these packages to be able to write to a socket.
In the main.pl file I have:
my $socket_handle = connect_server();
Then each package is able to see the global variable, I assume this is ok.
The connect_server is a module containing the code to connect to the
server using the Socket.pm module. I struggled with this for ages and
finally worked out that the socket is actually a kind of file and to
return() a file I had to do this:
my $socket_handle = *SOCKET_HANDLE; # Set the $socket_handle variable to
the SOCKET_HANDLE (pass file type handle with *)
return($socket_handle);
This seems to work. My question is; is this the right way to do this? Or
will it cause problems later maybe? If not, what is the correct way to do
this.
Many thanks for any help,
Gareth.