perldoc perlipc example fails, debian 4
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 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 ... |
unless you're running a daytime service (like ntp) locally and it's bound to localhost, this is bound to fail. On the upside, the fact that you get the "cannot connect to daytime port" means that it in fact did attempt to establish a socket call. Not so much a bad example as much as a poorly thought out one (depends too much on you having a particular service running).
|
Ah, I thought it would be something like that. I also thought that I had ntp running, but since I've rebuilt the system lately, maybe I don't :)
In a sideways fashion, maybe it wasn't such a bad example, because now I know more about IO::Socket::INET than I would've if the example had succeeded right away. |
All times are GMT -5. The time now is 05:51 PM. |