summaryrefslogtreecommitdiff
path: root/Ivy.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Ivy.pm')
-rw-r--r--Ivy.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/Ivy.pm b/Ivy.pm
index 1b4d760..11d667f 100644
--- a/Ivy.pm
+++ b/Ivy.pm
@@ -42,7 +42,7 @@ use Thread::Signal;
use Fcntl;
use Errno;
use vars qw($VERSION);
-$VERSION = '4.0';
+$VERSION = '4.1';
#############################################################################
#### PROTOTYPES #####
@@ -636,9 +636,9 @@ sub start ($)
############### METHODE BIND REGEXP
-sub bindRegexp ($$$)
+sub bindRegexp ($$$$)
{
- my ($self, $regexp, $cb) = @_;
+ my ($self, $regexp, $cb, $observer) = @_;
# on substitue les meta caracteres des regexps perl : \d, \w, \s, \e
# par les classes de caracteres corespondantes de maniere a ce
@@ -666,7 +666,7 @@ sub bindRegexp ($$$)
last unless (defined $self->[recCbList][$id]) &&
@{$self->[recCbList][$id]->[1]};
}
- $self->[recCbList][$id] = [$regexp, $cb];
+ $self->[recCbList][$id] = [$regexp, $cb, $observer];
# on envoie les messages regexps aux processus deja connectes
_sendLastRegexpToAllreadyConnected ($self, $id) ;
@@ -1167,7 +1167,13 @@ sub _getMessages ($$)
if (my @cb = @{$self->[recCbList][$id]->[1]}) {
my $cb = shift @cb;
# on split sur ETX
- &$cb ($senderName, @cb, split ("\003", $valeurs)) ;
+ my $observer = $self->[recCbList][$id]->[2];
+ if (defined $observer) {
+ $observer->$cb ($senderName, @cb, split ("\003", $valeurs)) ;
+ }
+ else {
+ &$cb ($senderName, @cb, split ("\003", $valeurs)) ;
+ }
} else {
#_sendErrorTo ($appSock, "REEGXP ID $id inconnue");
warn ("Attention Ivy::_getMessages reception d'un message " .