Of course I call the SendMessage sub once: &Communications::SendMessage("Hello, World!");package Communications; sub SendMessage { my $msg = join("", @_); foreach my $cpack (@main::plugpack) { if (defined eval "${cpack}::ReceiveMessage") { eval "\&${cpack}::ReceiveMessage('$msg')"; } } } sub ReceiveMessage { print "Communications::ReceiveMessage('$_[0]')\n"; }
It appears to me that ReceiveMessage is not only called when the message is sent, but also when SendMessage checks it's existance. How can I prevent this?Use of uninitialized value in concatenation (.) or string at D:\device +\modem\internet\Xitami\cgi-bin\index.pl line 48. Communications::ReceiveMessage('') Communications::ReceiveMessage('Hello, World!')
|
Comment on
See if a certain package has a certain sub, without executing that sub
Select or Download Code | |
|---|---|
| Re: See if a certain package has a certain sub, without executing that sub by gmax (Abbot) on Mar 20, 2004 at 15:27 UTC | |
by muba (Curate) on Mar 20, 2004 at 15:33 UTC |