Aside from kyle's good suggestions, I think I have an idea as to why you are getting the Invalid argument error.

I did a search on CPAN for Net::Rexec, and after reading the 4-sentence description, I decided to look at the source code (all 27 lines, or so). Here is a snippet:

sub rexec { my($host) = shift; my($sock) = IO::Socket::INET->new(PeerAddr => $host, PeerPort => 'exec(512)', Proto => 'tcp'); die "Error opening sock $!" if (!defined($sock));

It seems that you have to be careful how you pass the IP address to the sub, otherwise it might get corrupted. I think you need to make sure it gets passed as a string, instead of a number (with 3 decimal points). I created a little testcase to illustrate my point:

#!/usr/bin/env perl use warnings; use strict; foo('111.22.33.44'); foo(111.22.33.44); sub foo { my $host = shift; print "host=$host\n"; }

which prints:

host=111.22.33.44 host=o!,

I do not know why this happens. Perhaps a more knowledgeable monk can explain.

Update: this is my perl version (just in case this is OS- or version-specific):

This is perl, v5.8.5 built for x86_64-linux-thread-multi

In reply to Re: Problem with Net::rexec by toolic
in thread Problem with Net::rexec by padawan_linuxero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.