--- trunk/lib/Sack/Lorry.pm 2009/10/03 21:09:51 92 +++ trunk/lib/Sack/Lorry.pm 2009/10/03 21:43:34 93 @@ -51,6 +51,8 @@ warn "\nconnected to $port\n"; + $self->{connected}->{$port} = $host; + return $port++; } elsif ( ! defined $pid ) { @@ -78,16 +80,28 @@ sub send_to { my ( $self, $port, $data ) = @_; - warn ">>>> [$port] ", dump( keys %$data ), $/; + warn "send_to [$port]\n"; Storable::store_fd( $data => $self->{sock}->{$port} ); } sub get_from { my ( $self, $port ) = @_; - warn "<<<< [$port]\n"; + warn "get_from [$port]\n"; Storable::fd_retrieve( $self->{sock}->{$port} ); } +sub send_to_all { + my ( $self, $data ) = @_; + $self->send_to( $_, $data ) foreach keys %{ $self->{connected} }; +} + +sub get_from_all { + my ( $self ) = @_; + my $result; + $result->{$_} = $self->get_from( $_ ) foreach keys %{ $self->{connected} }; + return $result; +} + sub DESTROY { warn "pids ",dump( $pids ); foreach ( values %$pids ) {