… | |
… | |
409 | if ($reply->{args}[1] eq "key") { |
409 | if ($reply->{args}[1] eq "key") { |
410 | (my $key = $reply->{args}[2]) =~ s/\\x(..)/chr hex $1/ge; |
410 | (my $key = $reply->{args}[2]) =~ s/\\x(..)/chr hex $1/ge; |
411 | $self->on_key ($key); |
411 | $self->on_key ($key); |
412 | } |
412 | } |
413 | } else { |
413 | } else { |
414 | $self->on_event ($reply->{event}, $reply); |
414 | $self->on_event (delete $reply->{event}, $reply); |
415 | } |
415 | } |
416 | } elsif (exists $reply->{request_id}) { |
416 | } elsif (exists $reply->{request_id}) { |
417 | my $cv = delete $self->{cmd_cv}{$reply->{request_id}}; |
417 | my $cv = delete $self->{cmd_cv}{$reply->{request_id}}; |
418 | |
418 | |
419 | unless ($cv) { |
419 | unless ($cv) { |
… | |
… | |
504 | |
504 | |
505 | This method is called when F<mpv> sends an asynchronous event. The default |
505 | This method is called when F<mpv> sends an asynchronous event. The default |
506 | implementation will call the C<on_event> code reference specified in the |
506 | implementation will call the C<on_event> code reference specified in the |
507 | constructor, or do nothing if none was given. |
507 | constructor, or do nothing if none was given. |
508 | |
508 | |
509 | The first/implicit argument is the C<$mpv> object, the second is the event |
509 | The first/implicit argument is the C<$mpv> object, the second is the |
510 | name (same as C<< $data->{event} >>, purely for convenience), and the |
510 | event name (same as C<< $data->{event} >>, purely for convenience), and |
511 | third argument is the full event object as sent by F<mpv>. See L<List of |
511 | the third argument is the event object as sent by F<mpv> (sans C<event> |
512 | events|https://mpv.io/manual/stable/#list-of-events> in its documentation. |
512 | key). See L<List of events|https://mpv.io/manual/stable/#list-of-events> |
|
|
513 | in its documentation. |
513 | |
514 | |
514 | For subclassing, see I<SUBCLASSING>, below. |
515 | For subclassing, see I<SUBCLASSING>, below. |
515 | |
516 | |
516 | =cut |
517 | =cut |
517 | |
518 | |