ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP.pm
(Generate patch)

Comparing AnyEvent-MP/MP.pm (file contents):
Revision 1.102 by root, Tue Oct 6 13:37:52 2009 UTC vs.
Revision 1.103 by root, Sat Oct 17 01:42:39 2009 UTC

155 155
156use AE (); 156use AE ();
157 157
158use base "Exporter"; 158use base "Exporter";
159 159
160our $VERSION = 1.21; 160our $VERSION = 1.22;
161 161
162our @EXPORT = qw( 162our @EXPORT = qw(
163 NODE $NODE *SELF node_of after 163 NODE $NODE *SELF node_of after
164 configure 164 configure
165 snd rcv mon mon_guard kil psub peval spawn cal 165 snd rcv mon mon_guard kil psub peval spawn cal
406 if (ref $_[0]) { 406 if (ref $_[0]) {
407 if (my $self = $PORT_DATA{$portid}) { 407 if (my $self = $PORT_DATA{$portid}) {
408 "AnyEvent::MP::Port" eq ref $self 408 "AnyEvent::MP::Port" eq ref $self
409 or Carp::croak "$port: rcv can only be called on message matching ports, caught"; 409 or Carp::croak "$port: rcv can only be called on message matching ports, caught";
410 410
411 $self->[2] = shift; 411 $self->[0] = shift;
412 } else { 412 } else {
413 my $cb = shift; 413 my $cb = shift;
414 $PORT{$portid} = sub { 414 $PORT{$portid} = sub {
415 local $SELF = $port; 415 local $SELF = $port;
416 eval { &$cb }; _self_die if $@; 416 eval { &$cb }; _self_die if $@;
417 }; 417 };
418 } 418 }
419 } elsif (defined $_[0]) { 419 } elsif (defined $_[0]) {
420 my $self = $PORT_DATA{$portid} ||= do { 420 my $self = $PORT_DATA{$portid} ||= do {
421 my $self = bless [$PORT{$port} || sub { }, { }, $port], "AnyEvent::MP::Port"; 421 my $self = bless [$PORT{$portid} || sub { }, { }, $port], "AnyEvent::MP::Port";
422 422
423 $PORT{$portid} = sub { 423 $PORT{$portid} = sub {
424 local $SELF = $port; 424 local $SELF = $port;
425 425
426 if (my $cb = $self->[1]{$_[0]}) { 426 if (my $cb = $self->[1]{$_[0]}) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines