]> jfr.im git - irc/SurrealServices/srsv.git/commitdiff
better longterm fix for perl/Storable vs regexes
authortabris <redacted>
Mon, 31 Dec 2012 01:45:36 +0000 (01:45 +0000)
committertabris <redacted>
Mon, 31 Dec 2012 01:45:36 +0000 (01:45 +0000)
git-svn-id: http://svn.tabris.net/repos/srsv@3594 70d4eda1-72e9-0310-a436-91e5bd24443c

branches/0.4.3/SrSv/Process/Worker.pm
branches/0.4.3/perl-5.12-workaround.diff [deleted file]

index 6869fc05560aaaf9d459ac9497f1ac20b5ab7114..c311ca79d13a751887a2a5d2084b66452f53bdf8 100644 (file)
@@ -181,6 +181,18 @@ sub kill_all_workers() {
 sub do_callback_in_child {
        my ($callback, $message) = @_;
 
+       # this whole thing is a workaround for perl 5.12's Storable.
+       # Can't pass a regexp through Storable.
+       if(ref($callback->{TRIGGER_COND}->{DST}) || ref($callback->{TRIGGER_COND}->{SRC})) {
+               foreach my $k (qw(DST SRC)) {
+                       next unless defined $callback->{TRIGGER_COND}->{$k};
+                       my $v = $callback->{TRIGGER_COND}->{$k};
+                       $v = "$v"; # convert regexp to string
+                       $callback->{TRIGGER_COND}->{$k} = $v;
+               }
+               #use Data::Dumper;
+               #ircd::debug( split($/, Data::Dumper::Dumper($worker->{UNIT})) );
+       }
        if(my $worker = pop @free_workers) {
                print "Asking worker ".$worker->{NUMBER}." to call ".$callback->{CALL}."\n" if DEBUG;
                #store_fd([$unit], $worker->{SOCKET});
diff --git a/branches/0.4.3/perl-5.12-workaround.diff b/branches/0.4.3/perl-5.12-workaround.diff
deleted file mode 100644 (file)
index 4b4822f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-Index: SrSv/Process/Worker.pm
-===================================================================
---- SrSv/Process/Worker.pm     (revision 3510)
-+++ SrSv/Process/Worker.pm     (working copy)
-@@ -33,7 +33,7 @@ use Event;
- use English qw( -no_match_vars );
- use IO::Socket;
- use IO::File;
--use Storable qw(fd_retrieve store_fd);
-+use Storable qw(fd_retrieve store_fd dclone);
- use SrSv::Debug;
-@@ -181,6 +181,14 @@ sub kill_all_workers() {
- sub do_callback_in_child {
-       my ($callback, $message) = @_;
-+      # this whole thing is a workaround for perl 5.12's Storable.
-+      # Can't pass a regexp through Storable.
-+      if(ref($callback->{TRIGGER_COND}->{DST}) || ref($callback->{TRIGGER_COND}->{SRC})) {
-+              $callback->{TRIGGER_COND} = dclone($callback->{TRIGGER_COND});
-+              delete $callback->{TRIGGER_COND}->{DST};
-+              #use Data::Dumper;
-+              #ircd::debug( split($/, Data::Dumper::Dumper($worker->{UNIT})) );
-+      }
-       if(my $worker = pop @free_workers) {
-               print "Asking worker ".$worker->{NUMBER}." to call ".$callback->{CALL}."\n" if DEBUG;
-               #store_fd([$unit], $worker->{SOCKET});