make testcases use AnyEvent::I3
This commit is contained in:
parent
5e2ab5be65
commit
8fb641cca4
|
@ -1,7 +1,7 @@
|
|||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 3;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -9,6 +9,7 @@ use Time::HiRes qw(sleep);
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
|
@ -17,19 +18,14 @@ BEGIN {
|
|||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
|
||||
my $i3 = i3;
|
||||
|
||||
#####################################################################
|
||||
# Ensure IPC works by switching workspaces
|
||||
#####################################################################
|
||||
|
||||
# Switch to the first workspace to get a clean testing environment
|
||||
$sock->write(i3test::format_ipc_command("1"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('1')->recv;
|
||||
|
||||
# Create a window so we can get a focus different from NULL
|
||||
my $window = i3test::open_standard_window($x);
|
||||
|
@ -41,9 +37,7 @@ my $focus = $x->input_focus;
|
|||
diag("old focus = $focus");
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
my $new_focus = $x->input_focus;
|
||||
isnt($focus, $new_focus, "Focus changed");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 14;
|
||||
use Test::More tests => 13;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -12,29 +12,25 @@ use Time::HiRes qw(sleep);
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and make sure focus switching works
|
||||
#####################################################################
|
||||
|
||||
# Change mode of the container to "default" for following tests
|
||||
$sock->write(i3test::format_ipc_command("d"));
|
||||
sleep(0.25);
|
||||
$i3->command('d')->recv;
|
||||
|
||||
my $top = i3test::open_standard_window($x);
|
||||
my $mid = i3test::open_standard_window($x);
|
||||
|
@ -52,8 +48,7 @@ diag("bottom id = " . $bottom->id);
|
|||
sub focus_after {
|
||||
my $msg = shift;
|
||||
|
||||
$sock->write(i3test::format_ipc_command($msg));
|
||||
sleep(0.5);
|
||||
$i3->command($msg)->recv;
|
||||
return $x->input_focus;
|
||||
}
|
||||
|
||||
|
@ -81,8 +76,7 @@ is($focus, $top->id, "Top window focused (wrapping to the bottom works)");
|
|||
###############################################
|
||||
|
||||
# Switch to the 10. workspace
|
||||
$sock->write(i3test::format_ipc_command("10"));
|
||||
sleep 0.25;
|
||||
$i3->command('10')->recv;
|
||||
|
||||
$top = i3test::open_standard_window($x);
|
||||
$bottom = i3test::open_standard_window($x);
|
||||
|
@ -102,8 +96,7 @@ is($focus, $top->id, "Top window focused");
|
|||
# Same thing, but left/right instead of top/bottom
|
||||
|
||||
# Switch to the 11. workspace
|
||||
$sock->write(i3test::format_ipc_command("11"));
|
||||
sleep 0.25;
|
||||
$i3->command('11')->recv;
|
||||
|
||||
my $left = i3test::open_standard_window($x);
|
||||
my $right = i3test::open_standard_window($x);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 10;
|
||||
use Test::More tests => 8;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -12,21 +12,18 @@ use Time::HiRes qw(sleep);
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and make sure focus switching works
|
||||
|
@ -50,8 +47,7 @@ diag("bottom id = " . $bottom->id);
|
|||
sub focus_after {
|
||||
my $msg = shift;
|
||||
|
||||
$sock->write(i3test::format_ipc_command($msg));
|
||||
sleep(0.5);
|
||||
$i3->command($msg)->recv;
|
||||
return $x->input_focus;
|
||||
}
|
||||
|
||||
|
@ -82,9 +78,7 @@ is($focus, $top->id, "Top window focused");
|
|||
# Move window cross-workspace
|
||||
#####################################################################
|
||||
|
||||
$sock->write(i3test::format_ipc_command("m12"));
|
||||
$sock->write(i3test::format_ipc_command("t"));
|
||||
$sock->write(i3test::format_ipc_command("m13"));
|
||||
$sock->write(i3test::format_ipc_command("12"));
|
||||
$sock->write(i3test::format_ipc_command("13"));
|
||||
for my $cmd (qw(m12 t m13 12 13)) {
|
||||
$i3->command($cmd)->recv;
|
||||
}
|
||||
ok(1, "Still living");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Checks if the focus is correctly restored, when creating a floating client
|
||||
# over an unfocused tiling client and destroying the floating one again.
|
||||
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 4;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -11,28 +11,25 @@ use Time::HiRes qw(sleep);
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Window') or BAIL_OUT('Could not load X11::XCB::Window');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
my $tiled_left = i3test::open_standard_window($x);
|
||||
my $tiled_right = i3test::open_standard_window($x);
|
||||
|
||||
sleep(0.25);
|
||||
|
||||
$sock->write(i3test::format_ipc_command("ml"));
|
||||
$i3->command('ml')->recv;
|
||||
|
||||
# Get input focus before creating the floating window
|
||||
my $focus = $x->input_focus;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 24;
|
||||
use Test::More tests => 22;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -12,21 +12,18 @@ use Time::HiRes qw(sleep);
|
|||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and make sure focus switching works
|
||||
|
@ -50,8 +47,7 @@ diag("bottom id = " . $bottom->id);
|
|||
sub focus_after {
|
||||
my $msg = shift;
|
||||
|
||||
$sock->write(i3test::format_ipc_command($msg));
|
||||
sleep(0.25);
|
||||
$i3->command($msg)->recv;
|
||||
return $x->input_focus;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ use i3test;
|
|||
use List::Util qw(first);
|
||||
|
||||
BEGIN {
|
||||
#use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 7;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -13,21 +13,18 @@ use FindBin;
|
|||
use Digest::SHA1 qw(sha1_base64);
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep(0.25);
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and make sure focus switching works
|
||||
|
@ -51,8 +48,7 @@ diag("bottom id = " . $bottom->id);
|
|||
sub focus_after {
|
||||
my $msg = shift;
|
||||
|
||||
$sock->write(i3test::format_ipc_command($msg));
|
||||
sleep(0.5);
|
||||
$i3->command($msg)->recv;
|
||||
return $x->input_focus;
|
||||
}
|
||||
|
||||
|
@ -74,7 +70,7 @@ my $random_mark = sha1_base64(rand());
|
|||
$focus = focus_after("goto $random_mark");
|
||||
is($focus, $mid->id, "focus unchanged");
|
||||
|
||||
$sock->write(i3test::format_ipc_command("mark $random_mark"));
|
||||
$i3->command("mark $random_mark")->recv;
|
||||
|
||||
$focus = focus_after("k");
|
||||
is($focus, $top->id, "Top window focused");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 17;
|
||||
use Test::More tests => 15;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -13,21 +13,18 @@ use FindBin;
|
|||
use Digest::SHA1 qw(sha1_base64);
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep 0.25;
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create a floating window and see if resizing works
|
||||
|
@ -78,13 +75,11 @@ sub test_resize {
|
|||
test_resize;
|
||||
|
||||
# Test borderless
|
||||
$sock->write(i3test::format_ipc_command("bb"));
|
||||
sleep 0.25;
|
||||
$i3->command('bb')->recv;
|
||||
|
||||
test_resize;
|
||||
|
||||
# Test with 1-px-border
|
||||
$sock->write(i3test::format_ipc_command("bp"));
|
||||
sleep 0.25;
|
||||
$i3->command('bp')->recv;
|
||||
|
||||
test_resize;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 7;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -13,21 +13,18 @@ use FindBin;
|
|||
use Digest::SHA1 qw(sha1_base64);
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep 0.25;
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create two windows and put them in stacking mode
|
||||
|
@ -38,8 +35,7 @@ sleep 0.25;
|
|||
my $bottom = i3test::open_standard_window($x);
|
||||
sleep 0.25;
|
||||
|
||||
$sock->write(i3test::format_ipc_command("s"));
|
||||
sleep 0.25;
|
||||
$i3->command('s')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Add the urgency hint, switch to a different workspace and back again
|
||||
|
@ -47,12 +43,9 @@ sleep 0.25;
|
|||
$top->add_hint('urgency');
|
||||
sleep 1;
|
||||
|
||||
$sock->write(i3test::format_ipc_command("1"));
|
||||
sleep 0.25;
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
sleep 0.25;
|
||||
$sock->write(i3test::format_ipc_command("1"));
|
||||
sleep 0.25;
|
||||
$i3->command('1')->recv;
|
||||
$i3->command('9')->recv;
|
||||
$i3->command('1')->recv;
|
||||
|
||||
my $std = i3test::open_standard_window($x);
|
||||
sleep 0.25;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# the workspace to be empty).
|
||||
# TODO: skip it by default?
|
||||
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
use Test::Deep;
|
||||
use X11::XCB qw(:all);
|
||||
use Data::Dumper;
|
||||
|
@ -13,21 +13,17 @@ use FindBin;
|
|||
use Digest::SHA1 qw(sha1_base64);
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $x = X11::XCB::Connection->new;
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
# Switch to the nineth workspace
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
|
||||
sleep 0.25;
|
||||
$i3->command('9')->recv;
|
||||
|
||||
#####################################################################
|
||||
# Create a parent window
|
||||
|
@ -48,8 +44,7 @@ sleep 0.25;
|
|||
# Switch workspace to 10 and open a child window. It should be positioned
|
||||
# on workspace 9.
|
||||
#########################################################################
|
||||
$sock->write(i3test::format_ipc_command("10"));
|
||||
sleep 0.25;
|
||||
$i3->command('10')->recv;
|
||||
|
||||
my $child = $x->root->create_child(
|
||||
class => WINDOW_CLASS_INPUT_OUTPUT,
|
||||
|
@ -66,7 +61,6 @@ sleep 0.25;
|
|||
isnt($x->input_focus, $child->id, "Child window focused");
|
||||
|
||||
# Switch back
|
||||
$sock->write(i3test::format_ipc_command("9"));
|
||||
sleep 0.25;
|
||||
$i3->command('9')->recv;
|
||||
|
||||
is($x->input_focus, $child->id, "Child window focused");
|
||||
|
|
|
@ -1,52 +1,21 @@
|
|||
#!perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
|
||||
use Test::More tests => 8;
|
||||
use Test::More tests => 3;
|
||||
use Test::Exception;
|
||||
use Data::Dumper;
|
||||
use JSON::XS;
|
||||
use List::MoreUtils qw(all);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use i3test;
|
||||
use AnyEvent::I3;
|
||||
|
||||
BEGIN {
|
||||
use_ok('IO::Socket::UNIX') or BAIL_OUT('Cannot load IO::Socket::UNIX');
|
||||
use_ok('X11::XCB::Connection') or BAIL_OUT('Cannot load X11::XCB::Connection');
|
||||
}
|
||||
|
||||
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock');
|
||||
isa_ok($sock, 'IO::Socket::UNIX');
|
||||
my $i3 = i3;
|
||||
|
||||
####################
|
||||
# Request workspaces
|
||||
####################
|
||||
|
||||
# message type 1 is GET_WORKSPACES
|
||||
my $message = "i3-ipc" . pack("LL", 0, 1);
|
||||
$sock->write($message);
|
||||
|
||||
#######################################
|
||||
# Test the reply format for correctness
|
||||
#######################################
|
||||
|
||||
# The following lines duplicate functionality from recv_ipc_command
|
||||
# to have it included in the test-suite.
|
||||
my $buffer;
|
||||
$sock->read($buffer, length($message));
|
||||
is(substr($buffer, 0, length("i3-ipc")), "i3-ipc", "ipc message received");
|
||||
my ($len, $type) = unpack("LL", substr($buffer, 6));
|
||||
is($type, 1, "correct reply type");
|
||||
|
||||
# read the payload
|
||||
$sock->read($buffer, $len);
|
||||
my $workspaces;
|
||||
|
||||
#########################
|
||||
# Actually test the reply
|
||||
#########################
|
||||
|
||||
lives_ok { $workspaces = decode_json($buffer) } 'JSON could be decoded';
|
||||
my $workspaces = $i3->get_workspaces->recv;
|
||||
|
||||
ok(@{$workspaces} > 0, "More than zero workspaces found");
|
||||
|
||||
|
|
|
@ -29,33 +29,4 @@ sub open_standard_window {
|
|||
return $window;
|
||||
}
|
||||
|
||||
sub format_ipc_command {
|
||||
my $msg = shift;
|
||||
my $len;
|
||||
|
||||
{ use bytes; $len = length($msg); }
|
||||
|
||||
my $message = "i3-ipc" . pack("LL", $len, 0) . $msg;
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
sub recv_ipc_command {
|
||||
my ($sock, $expected) = @_;
|
||||
|
||||
my $buffer;
|
||||
# header is 14 bytes ("i3-ipc" + 32 bit + 32 bit)
|
||||
$sock->read($buffer, 14);
|
||||
return undef unless substr($buffer, 0, length("i3-ipc")) eq "i3-ipc";
|
||||
|
||||
my ($len, $type) = unpack("LL", substr($buffer, 6));
|
||||
|
||||
return undef unless $type == $expected;
|
||||
|
||||
# read the payload
|
||||
$sock->read($buffer, $len);
|
||||
|
||||
decode_json($buffer)
|
||||
}
|
||||
|
||||
1
|
||||
|
|
Loading…
Reference in New Issue