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

Comparing AnyEvent-MPV/MPV.pm (file contents):
Revision 1.19 by root, Sun Mar 26 17:15:18 2023 UTC vs.
Revision 1.20 by root, Sat Apr 1 06:32:32 2023 UTC

221use Scalar::Util (); 221use Scalar::Util ();
222 222
223use AnyEvent (); 223use AnyEvent ();
224use AnyEvent::Util (); 224use AnyEvent::Util ();
225 225
226our $VERSION = '1.01'; 226our $VERSION = '1.03';
227 227
228sub OBSID() { 0x10000000000000 } # 2**52 228sub OBSID() { 2**52 }
229 229
230our $JSON = eval { require JSON::XS; JSON::XS:: } 230our $JSON = eval { require JSON::XS; JSON::XS:: }
231 || do { require JSON::PP; JSON::PP:: }; 231 || do { require JSON::PP; JSON::PP:: };
232 232
233our $JSON_ENCODER = $JSON->new->utf8; 233our $JSON_ENCODER = $JSON->new->utf8;
488 488
489 $trace->(">mpv" => $cmd); 489 $trace->(">mpv" => $cmd);
490 490
491 $wbuf .= "$cmd\n"; 491 $wbuf .= "$cmd\n";
492 492
493 $self->{ww} ||= AE::io $fh, 1, sub { 493 my $wcb = sub {
494 my $len = syswrite $fh, $wbuf; 494 my $len = syswrite $fh, $wbuf;
495 substr $wbuf, 0, $len, ""; 495 substr $wbuf, 0, $len, "";
496 undef $self->{ww} unless length $wbuf; 496 undef $self->{ww} unless length $wbuf;
497 }; 497 };
498
499 $wcb->();
500 $self->{ww} ||= AE::io $fh, 1, $wcb if length $wbuf;
498 501
499 $cv 502 $cv
500 }; 503 };
501 504
502 1 505 1

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines