#! /usr/bin/perl
# $Id: filter-match,v 1.2 2007/06/21 12:46:37 tobez Exp $
use lib qw(lib ../lib);
use IPC::Messaging;

sub has_42
{
	my ($m,$d) = @_;
	return grep { $_ eq 42 } values %$d;
}

my $proc = spawn {
  receive_loop {
	got _ => \&has_42 => then {
		print "42!\n";
	};
    got done => then {
		exit;
    };
	got _ => then {
		print "not 42\n";
	};
  };
};

$proc->ping(i => 42);
$proc->ping(i => 43);
$proc->ping(n => 42);
$proc->done;
receive {
  got _ => then { exit; };
};
