This file is indexed.

/usr/share/doc/libio-socket-ip-perl/examples/connect.pl is in libio-socket-ip-perl 0.37-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
#!/usr/bin/perl

use strict;
use warnings;

use IO::Poll;
use IO::Socket::IP;
use Socket qw( SOCK_STREAM );
use Getopt::Long;

GetOptions(
   'timeout=f' => \my $TIMEOUT,
) or exit 1;

my $host    = shift @ARGV or die "Need HOST\n";
my $service = shift @ARGV or die "Need SERVICE\n";

my $socket = IO::Socket::IP->new(
   PeerHost    => $host,
   PeerService => $service,
   Type        => SOCK_STREAM,
   Timeout     => $TIMEOUT,
) or die "Cannot connect to $host:$service - $@";

printf STDERR "Connected to %s:%s\n", $socket->peerhost_service;

my $poll = IO::Poll->new;

$poll->mask( \*STDIN => POLLIN );
$poll->mask( $socket => POLLIN );

while(1) {
   $poll->poll( undef );

   if( $poll->events( \*STDIN ) ) {
      my $ret = STDIN->sysread( my $buffer, 8192 );
      defined $ret or die "Cannot read STDIN - $!\n";
      $ret or last;
      $socket->syswrite( $buffer );
   }
   if( $poll->events( $socket ) ) {
      my $ret = $socket->sysread( my $buffer, 8192 );
      defined $ret or die "Cannot read socket - $!\n";
      $ret or last;
      STDOUT->syswrite( $buffer );
   }
}