Net::SSH::Perl slowness

If you’re encountering slowness using the Net::SSH::Perl module connecting to a site, are you using DSA keys? In my Ubuntu 7.04, I discovered that the Crypt::DSA module was only using /dev/random to get its randomness. /dev/random gives true randomness as such will block if the kernel’s entropy pool is empty (cat /dev/random, if you don’t see any garbage, then the pool is empty). The fix is to edit /usr/local/share/perl/5.8.8/Crypt/DSA/ find the reference to /dev/random and change it to /dev/urandom.

perl code snipet for issuing POST

This took way to long to lookup how to do. This issues a POST command to a cgi ($url), fetches the resulting content back and then parses the XML data. <br /> use XML::Simple;<br /> use LWP::UserAgent;<br /> use HTTP::Request::Common qw(POST);</p> <p> my $ua = LWP::UserAgent->new;</p> <p> my $req = HTTP::Request->new(POST => $url);<br /> $req->content_type(‘application/x-www-form-urlencoded’);<br /> $req->content("Mac_Id=$mac");</p> <p> my $res = $ua->request($req);<br /> my $xml = $res->content;</p> <p> # Parse cfgdata<br /> my $xsl = XML::Simple->new();<br /> my $config = eval { $xsl->XMLin($xml)} ;<br /> if($@) { # bad XML<br /> print "Invalid XML for $mac\n";<br /> print ERROR "Invalid XML for $mac\n";<br /> next;<br /> }</p> <p>