Net-Async-Tangence

 view release on metacpan or  search on metacpan

lib/Net/Async/Tangence/Client.pm  view on Meta::CPAN

=item on_registry => CODE

=item on_root => CODE

Invoked once the registry and root object proxies have been obtained from the
server. See the documentation the L<Tangence::Client> C<tangence_connected>
method.

=item family => STRING

Optional. May be set to C<inet4> or C<inet6> to force IPv4 or IPv6 if
relevant. Ignored by C<exec:> and C<unix:> schemes.

=back

The following URL schemes are recognised:

=over 4

=cut

lib/Net/Async/Tangence/Client.pm  view on Meta::CPAN


=cut

sub connect_tcp
{
   my $self = shift;
   my ( $authority, %args ) = @_;

   my $family;
   $family = Socket::PF_INET() if $args{family} and $args{family} eq "inet4";
   $family = Socket::PF_INET6() if $args{family} and $args{family} eq "inet6";

   my ( $host, $port ) = $authority =~ m/^(.*):(.*)$/;

   $self->connect(
      host     => $host,
      service  => $port,
   );
}

=item * unix

lib/Net/Async/Tangence/Client/via/sshexec.pm  view on Meta::CPAN

use v5.14;
use warnings;

sub connect
{
   my $client = shift;
   my ( $uri, %args ) = @_;

   my @sshargs;
   push @sshargs, "-4" if $args{family} and $args{family} eq "inet4";
   push @sshargs, "-6" if $args{family} and $args{family} eq "inet6";

   my $host  = $uri->authority;

   my $path  = $uri->path;
   # Path will start with a leading /; we need to trim that
   $path =~ s{^/}{};

   my $query = $uri->query;
   defined $query or $query = "";
   # $query will contain args to exec - split them on +

lib/Net/Async/Tangence/Client/via/sshunix.pm  view on Meta::CPAN

   my $client = shift;
   my ( $uri, %args ) = @_;

   my $host = $uri->authority;
   my $path = $uri->path;
   # Path will start with a leading /; we need to trim that
   $path =~ s{^/}{};

   my @sshargs;
   push @sshargs, "-4" if $args{family} and $args{family} eq "inet4";
   push @sshargs, "-6" if $args{family} and $args{family} eq "inet6";

   return $client->connect_exec(
      # Tell the remote perl we're going to send it a program on STDIN
      [ 'ssh', @sshargs, $host, 'perl', '-', $path ]
   )->then( sub {
      $client->write( _NC_MICRO . "\n__END__\n" );
      my $f = $client->new_future;

      $client->configure( on_read => sub {
         my ( $self, $buffref, $eof ) = @_;



( run in 0.244 second using v1.01-cache-2.11-cpan-87723dcf8b7 )