Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: threads, forks and SSH

by serf (Chaplain)
on Dec 15, 2015 at 13:31 UTC ( [id://1150374]=note: print w/replies, xml ) Need Help??


in reply to Re: threads, forks and SSH
in thread threads, forks and SSH

Meh about:
system 'cat $host.csv'; system 'rm $host.csv';

You have open and print, you have unlink, and you have ways of checking that what you wanted to do worked correctly.

Perl isn't a shell script.

I would suggest that it's more reliable, more efficient, more cross-OS portable, and generally better practice to do these things natively in Perl than shelling out via system.

I get given grief at my $JOB by "scripts" that people who don't know Perl have written in Perl which should be in Perl but are full of awk and sed and grep and wc pipes and other badness. These scripts spawn many more processes than they need to, use more memory, and end up doing knarly things like jamming up, failing silently or causing excessive IO over NFS etc, bringing down our systems.

When we post code on perlmonks, people who don't know as much as we do will take what we've written without understanding it and use it thinking it's the *right* way to do it. I think we should try and be responsible and steer them in the right direction.

/me dismounts soapbox

Replies are listed 'Best First'.
Re^3: threads, forks and SSH
by ralph2014 (Initiate) on Dec 15, 2015 at 14:04 UTC
    Morning again Monks! Thank you so much for the replies. This module sounds just what im looking for. Im not too bothered about things being a little dirty aslong as it gets it done quickly and I get decent output. I should add its a windows server 2003. ralph
      Oops, then you can not use it: Net::OpenSSH does not work on Windows.

      Your best option there is to go for Net::SSH2 or Net::SSH::Perl, but IIRC, both have issues with threads.

        evening Well that has burst my bubble! I really liked the look of openSSH:Para. This is going to be a pain now, but atleast I will learn i guess
      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1150374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-16 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found