I'm just curious why this example from the perl docs doesn't work. The service of course exists in /etc/services. I edited the code trivially to use warnings and strict, I read 'perldoc IO::Socket::INET', I've tried several variations, but it doesn't work no matter what I tried:
Code:
#!/usr/bin/perl
# local-001 - example from perlipc (perl 5.8.8)
use strict;
use warnings;
use IO::Socket::INET;
my $remote = IO::Socket::INET->new (
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "daytime(13)",
)
or die "cannot connect to daytime port at localhost";
while (<$remote>) {print}
tale@hyute:~/00-perl$ ./local-001
cannot connect to daytime port at localhost at ./local-001 line 7.
It's not a big deal, however it helps when you're learning a language to be rigorous about why things fail ... and I'm just learning perl. I think there's a system-related reason why I can't access that socket ...