AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

example/jobrunner  view on Meta::CPAN


unless(@ARGV > 0)
{
  print "usage: $0 command [arg1 [ arg2 [ ... ] ]\n";
  exit 1;
}

my $client = AnyEvent::WebSocket::Client->new;
my $connection = $client->connect("ws://localhost:3000/run")->recv;

# error stdout stderr signal exit

my $done = AnyEvent->condvar;

my $ipc = AnyEvent::Open3::Simple->new(
  on_stdout => sub {
    my($proc, $line) = @_;
    print $line, "\n";
    $connection->send(to_json({ type => 'out', data => $line }));
  },
  on_stderr => sub {
    my($proc, $line) = @_;
    print STDERR $line, "\n";
    $connection->send(to_json({ type => 'err', data => $line }));
  },
  on_exit => sub {
    my($proc, $exit, $signal) = @_;
    $connection->send(to_json({ type => 'exit', exit => $exit, signal => $signal }));
    $done->send([$exit,$signal]);
  },
  on_error => sub {

t/anyevent_websocket_client__scope.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::Module 'Capture::Tiny';
use Test2::Require::Module 'Test::Memory::Cycle';
use Test2::Require::Module 'Devel::Cycle';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Server qw( start_server );
use AnyEvent::WebSocket::Client;
use Capture::Tiny qw( capture_stderr );
use Test::Memory::Cycle;

my $finished = 0;
my $done1 = AnyEvent->condvar;
my $done2 = AnyEvent->condvar;

my $uri = start_server(
  message => sub {
    my $opt = { @_ };

t/anyevent_websocket_client__scope.t  view on Meta::CPAN

$connection->on(each_message => sub { $done2->send });

isa_ok $connection, 'AnyEvent::WebSocket::Connection';

is $finished, 0, 'finished = 0';

$connection->send('foo');

is $finished, 0, 'finished = 0';

note capture_stderr { memory_cycle_ok $connection };

$done2->recv;

$connection->close;

note capture_stderr { memory_cycle_ok $connection };

undef $connection;

$done1->recv;

is $finished, 1, 'finished = 1';

done_testing;

xt/author/pod_spelling_system.t  view on Meta::CPAN

  if -r $config_filename;

plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip};

chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));

add_stopwords($config->{pod_spelling_system}->{stopwords}->@*);
add_stopwords(qw(
Plicease
stdout
stderr
stdin
subref
loopback
username
os
Ollis
Mojolicious
plicease
CPAN
reinstall



( run in 1.526 second using v1.01-cache-2.11-cpan-49f99fa48dc )