Net::SSH::Perl should be able to find that identity file by default anyway, but I believe you do need to login, even if there is no user or password:
my $ssh = Net::SSH::Perl->new("host", @key); $ssh->login; my ($out, $err, $exit) = $ssh->cmd("uname -a");
It looks like you are out of luck if you want a non-interactive session on a key that has a passphrase, though I have found that wrapping the above in a shell script like this works:
./my_ssh_script <<EOT passphrase EOT
I haven't needed passphrases badly enough to inquire about a change (I just create the keys without passphrases), but reading the docs, it looks like the author (our own btrott) has thought about it, but hasn't gotten 'round 'tuit yet.

In reply to Re: Net::SSH::Perl Question by runrig
in thread Net::SSH::Perl Question by PrimeLord

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.