… | |
… | |
82 | |
82 | |
83 | use AE (); |
83 | use AE (); |
84 | |
84 | |
85 | use base "Exporter"; |
85 | use base "Exporter"; |
86 | |
86 | |
87 | our $VERSION = '0.01'; |
87 | our $VERSION = '0.02'; |
88 | our @EXPORT = qw( |
88 | our @EXPORT = qw( |
89 | NODE $NODE $PORT snd rcv _any_ |
89 | NODE $NODE $PORT snd rcv _any_ |
90 | create_port create_port_on |
90 | create_port create_port_on |
|
|
91 | create_miniport |
91 | become_slave become_public |
92 | become_slave become_public |
92 | ); |
93 | ); |
93 | |
94 | |
94 | =item NODE / $NODE |
95 | =item NODE / $NODE |
95 | |
96 | |
… | |
… | |
153 | && undef $_; |
154 | && undef $_; |
154 | } |
155 | } |
155 | }; |
156 | }; |
156 | |
157 | |
157 | $self |
158 | $self |
|
|
159 | } |
|
|
160 | |
|
|
161 | =item $portid = create_miniport { } |
|
|
162 | |
|
|
163 | Creates a "mini port", that is, a port without much #TODO |
|
|
164 | |
|
|
165 | =cut |
|
|
166 | |
|
|
167 | sub create_miniport(&) { |
|
|
168 | my $cb = shift; |
|
|
169 | my $id = "$AnyEvent::MP::Base::UNIQ." . ++$AnyEvent::MP::Base::ID; |
|
|
170 | |
|
|
171 | $AnyEvent::MP::Base::PORT{$id} = sub { |
|
|
172 | &$cb |
|
|
173 | and delete $AnyEvent::MP::Base::PORT{$id}; |
|
|
174 | }; |
|
|
175 | |
|
|
176 | "$NODE#$id" |
158 | } |
177 | } |
159 | |
178 | |
160 | package AnyEvent::MP::Port; |
179 | package AnyEvent::MP::Port; |
161 | |
180 | |
162 | =back |
181 | =back |