… | |
… | |
34 | |
34 | |
35 | use base "Exporter"; |
35 | use base "Exporter"; |
36 | |
36 | |
37 | our $VERSION = '0.6'; |
37 | our $VERSION = '0.6'; |
38 | our @EXPORT = qw( |
38 | our @EXPORT = qw( |
39 | %NODE %PORT %PORT_DATA $UNIQ $RUNIQ $ID add_node load_func |
39 | %NODE %PORT %PORT_DATA $UNIQ $RUNIQ $ID add_node load_func snd_to_func |
40 | |
40 | |
41 | NODE $NODE node_of snd kil |
41 | NODE $NODE node_of snd kil |
42 | resolve_node initialise_node |
42 | resolve_node initialise_node |
43 | ); |
43 | ); |
44 | |
44 | |
… | |
… | |
215 | |
215 | |
216 | warn "SND $noderef <- $portid @_\n" if TRACE;#d# |
216 | warn "SND $noderef <- $portid @_\n" if TRACE;#d# |
217 | |
217 | |
218 | ($NODE{$noderef} || add_node $noderef) |
218 | ($NODE{$noderef} || add_node $noderef) |
219 | ->{send} (["$portid", @_]); |
219 | ->{send} (["$portid", @_]); |
|
|
220 | } |
|
|
221 | |
|
|
222 | =item snd_to_func $noderef, $func, @args |
|
|
223 | |
|
|
224 | Expects a noderef and a name of a function. Asynchronously tries to call |
|
|
225 | this function with the given arguments on that node. |
|
|
226 | |
|
|
227 | This fucntion can be used to implement C<spawn>-like interfaces. |
|
|
228 | |
|
|
229 | =cut |
|
|
230 | |
|
|
231 | sub snd_to_func { |
|
|
232 | my $noderef = shift; |
|
|
233 | |
|
|
234 | ($NODE{$noderef} || add_node $noderef) |
|
|
235 | ->send (["", @_]); |
220 | } |
236 | } |
221 | |
237 | |
222 | sub kil(@) { |
238 | sub kil(@) { |
223 | my ($noderef, $portid) = split /#/, shift, 2; |
239 | my ($noderef, $portid) = split /#/, shift, 2; |
224 | |
240 | |