use Net::ZooKeeper qw(:node_flags :acls); my $zkh = Net::ZooKeeper->new('localhost:7000'); $zkh->create('/myzknode, 'active', 'flags' => ZOO_EPHEMERAL, 'acl' => ZOO_OPEN_ACL_UNSAFE) or die("unable to create node /myzknode: " . $zkh->get_error() . "\n"); print "node /myzknode has value: " . $zkh->get('/myzknode') . "\n"; #### my $watch = $zkh->watch('timeout' => 10000); $zkh->exists('/myzknode', 'watch' => $watch); if ($watch->wait()) { print "watch triggered on node /myzknode:\n"; print " event: $watch->{event}\n"; print " state: $watch->{state}\n"; } else { print "watch timed out after 10 seconds\n"; }