summaryrefslogtreecommitdiff
path: root/Ivy.pm
diff options
context:
space:
mode:
authormertz2001-04-05 15:45:59 +0000
committermertz2001-04-05 15:45:59 +0000
commit534e77beebca0864f13b50578d8f1bc3eac26af1 (patch)
tree656e055bd83608ed108db1aa67ae8e976b621191 /Ivy.pm
parentb793d603f415b8e10621eceb9b927950e639fed4 (diff)
downloadivy-perl-534e77beebca0864f13b50578d8f1bc3eac26af1.zip
ivy-perl-534e77beebca0864f13b50578d8f1bc3eac26af1.tar.gz
ivy-perl-534e77beebca0864f13b50578d8f1bc3eac26af1.tar.bz2
ivy-perl-534e77beebca0864f13b50578d8f1bc3eac26af1.tar.xz
* Correction of \s and \S expansion in regexp
* Better documentation of statusFunc parameter of New method * if an appli start two times the same bus it still work now
Diffstat (limited to 'Ivy.pm')
-rw-r--r--Ivy.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/Ivy.pm b/Ivy.pm
index 31e7872..da21ad4 100644
--- a/Ivy.pm
+++ b/Ivy.pm
@@ -38,7 +38,7 @@ use Time::Gettimeofday;
use vars qw($VERSION);
-$VERSION = '4.6';
+$VERSION = '4.7';
#############################################################################
#### PROTOTYPES #####
@@ -170,8 +170,8 @@ use constant MAX_TIMOUT => 1000;
# ne pas mettre un \n dans une chaine entre "" car l'\n sera interprete.
use constant REG_PERLISSISME => ('w' => '[a-zA-Z0-9_]',
'W' => '[^a-zA-Z0-9_]',
- 's' => '[\t ]',
- 'S' => '[^\t ]',
+ 's' => "[\t ]",
+ 'S' => "[^\t ]",
'd' => '[0-9]',
'D' => '[^0-9]',
'n' => '', # Il ne faut pas mettre d'\n :
@@ -601,6 +601,10 @@ sub start
$self = shift;
}
+ if ($self->[connSock]) {
+ print "*** the Ivy bus is already started\n";
+ return;
+ }
# cree la socket de connexion, recupere le no de port
my $connSock = $self->[connSock] = IO::Socket::INET->new(Listen => 128,
Proto => 'tcp',
@@ -1553,7 +1557,6 @@ sub _parseIvyBusParam ($)
my @broadcastAddrs = split (',', $ivyNetworks);
foreach my $netAddr (@broadcastAddrs) {
- print "netAddr=$netAddr\n";
$netAddr = BROADCAST_ADDRS if
(($netAddr eq '') || ($netAddr =~ /^127/) ||
($netAddr =~ /^loopback/));
@@ -1772,14 +1775,16 @@ before running.
=item B<-statusFunc =E<gt> sub {}>
-A callback which will be called every time an appli is connected or deconnected on the bus.
+A callback which will be called every time an appli is connected or deconnected on the bus. The first 3 parameters are a reference to an array of connected appli, a reference to an array of not connected appli (according to the "-neededApp" argument of the new method/function), a reference to a hash table of connected appli (giving the number of such appli). These parameters are maintained for upwards compatibility but should no more be used, since the following three parameters are really easier to use: the name of an appearing/disapearing appli, its status either "new" or "died", and the hostname where this appli is running/dying.
Your callback could be:
sub MyCallback {
- my ($present, $absent, %present, $appname, $status, $host) = @_;
+ my ($ref_array_present, $ref_array_absent, $ref_hash_present, $appname, $status, $host) = @_;
+
# $status is either new or died
-
+
+ my %present=%$ref_hash_present;
foreach my $remoteapp (keys %present) {
if ($present{$remoteapp} > 1) {
print "n apps $remoteapp are presents on bus\n";