Group
Extension

Matches 6

AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP.pm ( view source; MetaCPAN )
to the
receiving port.

The type of data you can transfer depends on the transport protocol: when
JSON is used, then only strings, numbers and arrays and hashes consisting
of those are allowed (no obj
a single
code reference stored in a global hash - it can't become much cheaper.

=item Why favour JSON, why not a real serialising format such as Storable?

In fact, any AnyEvent::MP node will happily
Storable by
default (although all nodes will accept it).

The default framing protocol is JSON because a) JSON::XS is many times
faster for small messages and b) most importantly, after years of
exper
AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP/Config.pm ( view source; MetaCPAN )
ment.

=cut

package AnyEvent::MP::Config;

use common::sense;

use Carp ();
use AnyEvent ();
use JSON::XS ();

our $VERSION = '2.02';

our $CONFIG_FILE = exists $ENV{PERL_ANYEVENT_MP_RC} ? $ENV{PERL_
pen my $fh, "<:raw", $CONFIG_FILE) {
      return if eval {
         local $/;
         %CFG = %{ JSON::XS->new->utf8->relaxed->decode (scalar <$fh>) };
         1
      };
   }

   %CFG = (
      ver
$fh, ">:raw", "$CONFIG_FILE~new~"
      or Carp::croak "$CONFIG_FILE~new~: $!";

   syswrite $fh, JSON::XS->new->pretty->utf8->encode (\%CFG) . "\n"
      or Carp::croak "$CONFIG_FILE~new~: $!";

   c
AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP/Intro.pod ( view source; MetaCPAN )
 a list of Perl
strings, numbers, hashes and arrays, anything that can be expressed as a
L<JSON> text (as JSON is the default serialiser in the protocol). Here are
two examples:

    write_log => 1251
AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP/Transport.pm ( view source; MetaCPAN )
 ($_[0]));
      };
   } elsif ($framing eq "json") {
      require JSON::XS;
      $self->{send} = sub {
         $push_write->($hdl, JSON::XS::encode_json ($_[0]));
      };
   } else {
      $self-
_multiple ($_[0]{rbuf});

         ()
      });
   } elsif ($framing eq "json") {
      require JSON::XS;
      my $coder = JSON::XS->new->utf8;

      $hdl->on_read (sub {
         $AnyEvent::MP::Ker
 First Greeting Line

Example:

   aemp;0;rain;tls_sha3_512,hmac_sha3_512,tls_anon,cleartext;cbor,json,storable;timeout=12;peeraddr=10.0.0.1:48082

The first line contains strings separated (not ended
AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP/Kernel.pm ( view source; MetaCPAN )
ere you need to know the source node ID.

=cut

sub _inject {
   warn "RCV $SRCNODE -> " . eval { JSON::XS->new->encode (\@_) } . "\n" if TRACE && @_;

   &{ $PORT{+shift} or return };
}

# this funct

sub snd(@) {
   my ($nodeid, $portid) = split /#/, shift, 2;

   warn "SND $nodeid <- " . eval { JSON::XS->new->encode ([$portid, @_]) } . "\n" if TRACE && @_;

   ($NODE{$nodeid} || add_node $nodeid

our $sv_eq_coder = JSON::XS->new->utf8->allow_nonref;

# are the two scalars equal? very very ugly and slow, need better way
sub sv_eq($$) {
   ref $_[0] || ref $_[1]
      ? (JSON::XS::encode $sv_eq
AnyEvent-MP ( M/ML/MLEHMANN/AnyEvent-MP-2.02.tar.gz, MLEHMANN, 2018; MetaCPAN )
AnyEvent-MP/MP/Global.pm ( view source; MetaCPAN )
######################
# node protocol parts for global nodes

package AnyEvent::MP::Kernel;

use JSON::XS ();

# TODO: this is ugly (classical use vars vs. our),
# maybe this should go into MP::Kerne

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.