This file is indexed.

/usr/share/perl5/Object/Remote/ReadChannel.pm is in libobject-remote-perl 0.004000-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package Object::Remote::ReadChannel;

use Scalar::Util qw(weaken openhandle);
use Object::Remote::Logging qw(:log :dlog router );
use Moo;

BEGIN { router()->exclude_forwarding }

has fh => (
  is => 'ro', required => 1,
  trigger => sub {
    my ($self, $fh) = @_;
    weaken($self);
    log_trace { "Watching filehandle via trigger on 'fh' attribute in Object::Remote::ReadChannel" };
    Object::Remote->current_loop
                  ->watch_io(
                      handle => $fh,
                      on_read_ready => sub { $self->_receive_data_from($fh) }
                    );
  },
);

has on_close_call => (
  is => 'rw', default => sub { sub {} },
);

has on_line_call => (is => 'rw');

has _receive_data_buffer => (is => 'ro', default => sub { my $x = ''; \$x });

sub _receive_data_from {
  my ($self, $fh) = @_;
  Dlog_trace { "Preparing to read data from $_" } $fh;
  my $rb = $self->_receive_data_buffer;
  my $len = sysread($fh, $$rb, 32768, length($$rb));
  my $err = defined($len) ? 'eof' : ": $!";
  if (defined($len) and $len > 0) {
    log_trace { "Read $len bytes of data" };
    while (my $cb = $self->on_line_call and $$rb =~ s/^(.*)\n//) {
      $cb->(my $line = $1);
    }
  } else {
    log_trace { "Got EOF or error, this read channel is done" };
    Object::Remote->current_loop
                  ->unwatch_io(
                      handle => $self->fh,
                      on_read_ready => 1
                    );
    log_trace { "Invoking on_close_call() for dead read channel" };
    $self->on_close_call->($err);
  }
}

sub DEMOLISH {
  my ($self, $gd) = @_;
  return if $gd;
  log_trace { "read channel is being demolished" };

  Object::Remote->current_loop
                ->unwatch_io(
                    handle => $self->fh,
                    on_read_ready => 1
                  );
}

1;