kwaping has asked for the wisdom of the Perl Monks concerning the following question:

This is an interesting issue... I've written a small client program to connect to a certain port, send a query and receive back some information.
#!/usr/bin/perl use strict; use warnings; # usage: ./ mac_address use Carp; use IO::Socket::INET; die "Could not create socket: $!" unless my $sock = IO::Socket::INET->new( PeerAddr => '', PeerPort => xxxx, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 10, ); foreach my $cmd (@ARGV) { print $sock "$cmd\n" or die $!; } print $sock "EOT\n" or die $!; my @text = <$sock>; close($sock) or die $!; print @text;
This script runs fine when I ssh to the LTSP server and run it from the command line. However, each LTSP terminal that will run this script takes its filesystem from the server, and the only writable directory is /tmp - the rest are read-only. When I try to run the script from the LTSP terminal's command line, I get the error "Could not create socket: Invalid argument at /usr/local/bin/ line 11."

Can anyone tell me why this is the case, and better yet how to resolve this issue? Thanks in advance!

Update: Resolved!! The issue lies somewhere in the hostname lookup. Changing the PeerAddr from using the name to using the IP resolved my issue. I still need to figure out why that's a problem, but at least now my project can progress. Thanks again to the responders, especially Thelonius for reminding me to use the debugger.

It's all fine and dandy until someone has to look at the code.