muba has asked for the wisdom of the Perl Monks concerning the following question:
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!')
|
---|
Replies are listed 'Best First'. | |
---|---|
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 (Priest) on Mar 20, 2004 at 15:33 UTC |