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

Comparing AnyEvent-Fork-RPC/RPC.pm (file contents):
Revision 1.27 by root, Sun Apr 28 14:34:40 2013 UTC vs.
Revision 1.28 by root, Sun Apr 28 15:48:31 2013 UTC

455 ( 455 (
456 sub { Storable::freeze \@_ }, 456 sub { Storable::freeze \@_ },
457 sub { @{ Storable::thaw shift } } 457 sub { @{ Storable::thaw shift } }
458 ) 458 )
459 459
460=item portable storable - C<$AnyEvent::Fork::RPC::NSTORABLE_SERIALISER>
461
462This serialiser also uses L<Storable>, but uses it's "network" format
463to serialise data, which makes it possible to talk to incompatible
464perl versions (for example, when talking to a process created with
465L<AnyEvent::Fork::Remote>).
466
467Implementation:
468
469 use Storable ();
470 (
471 sub { Storable::nfreeze \@_ },
472 sub { @{ Storable::thaw shift } }
473 )
474
460=back 475=back
461 476
462=back 477=back
463 478
464See the examples section earlier in this document for some actual 479See the examples section earlier in this document for some actual
465examples. 480examples.
466 481
467=cut 482=cut
468 483
469our $STRING_SERIALISER = '(sub { pack "(w/a*)*", @_ }, sub { unpack "(w/a*)*", shift })'; 484our $STRING_SERIALISER = '(sub { pack "(w/a*)*", @_ }, sub { unpack "(w/a*)*", shift })';
470our $JSON_SERIALISER = 'use JSON (); (sub { JSON::encode_json \@_ }, sub { @{ JSON::decode_json shift } })'; 485our $JSON_SERIALISER = 'use JSON (); (sub { JSON::encode_json \@_ }, sub { @{ JSON::decode_json shift } })';
471our $STORABLE_SERIALISER = 'use Storable (); (sub { Storable::freeze \@_ }, sub { @{ Storable::thaw shift } })'; 486our $STORABLE_SERIALISER = 'use Storable (); (sub { Storable::freeze \@_ }, sub { @{ Storable::thaw shift } })';
487our $NSTORABLE_SERIALISER = 'use Storable (); (sub { Storable::nfreeze \@_ }, sub { @{ Storable::thaw shift } })';
472 488
473sub run { 489sub run {
474 my ($self, $function, %arg) = @_; 490 my ($self, $function, %arg) = @_;
475 491
476 my $serialiser = delete $arg{serialiser} || $STRING_SERIALISER; 492 my $serialiser = delete $arg{serialiser} || $STRING_SERIALISER;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines