/usr/share/perl5/Pod/Webserver/Daemon.pm is in libpod-webserver-perl 3.11-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 67 68 69 70 71 72 73 74 75 76 | package Pod::Webserver::Daemon;
use strict;
use warnings;
use Pod::Webserver::Connection;
our $VERSION = '3.11';
use Socket qw(PF_INET SOCK_STREAM SOMAXCONN inet_aton sockaddr_in);
# ------------------------------------------------
sub accept {
my $self = shift;
my $sock = $self->{__sock};
my $rin = '';
vec($rin, fileno($sock), 1) = 1;
# Sadly getting a valid returned time from select is not portable
my $end = $self->{Timeout} + time;
do {
if (select ($rin, undef, undef, $self->{Timeout})) {
# Ready for reading;
my $got = do {local *GOT; \*GOT};
#$! = "";
accept $got, $sock or die "Error: accept failed: $!\n";
return Pod::Webserver::Connection->new($got);
}
} while (time < $end);
return undef;
} # End of accept.
# ------------------------------------------------
sub new {
my $class = shift;
my $self = {@_};
$self->{LocalHost} ||= 'localhost';
# Anonymous file handles the 5.004 way:
my $sock = do {local *SOCK; \*SOCK};
my $proto = getprotobyname('tcp') or die "Error in getprotobyname: $!\n";
socket($sock, PF_INET, SOCK_STREAM, $proto) or die "Can't create socket: $!\n";
my $host = inet_aton($self->{LocalHost})
or die "Can't resolve hostname '$self->{LocalHost}'\n";
my $sin = sockaddr_in($self->{LocalPort}, $host);
bind $sock, $sin
or die "Couldn't bind to $self->{LocalHost}:$self->{LocalPort}: $!\n";
listen $sock, SOMAXCONN or die "Couldn't listen on socket: $!\n";
$self->{__sock} = $sock;
return bless $self, $class;
} # End of accept.
# ------------------------------------------------
sub url {
my $self = shift;
return "http://$self->{LocalHost}:$self->{LocalPort}/";
} # End of url.
# ------------------------------------------------
1;
|