X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=lib%2FRexec.pm;h=6db57353337256a178b313686f6c7098adb62d95;hb=9956e403ab89bc984faf9cb22a8860a34c310ac7;hp=71fdd224da40d6b0ac488004ee8add2d5d4b4c97;hpb=4accf346e37b757479d5f1537e71996f5d96a061;p=clearscm.git diff --git a/lib/Rexec.pm b/lib/Rexec.pm index 71fdd22..6db5735 100644 --- a/lib/Rexec.pm +++ b/lib/Rexec.pm @@ -160,16 +160,18 @@ our @EXPORT = qw ( my @lines; -sub _debug ($) { +sub _debug ($) { my ($msg) = @_; - + my $logfile = "/tmp/rexex_debug.log"; - - open my $file, '>>', $logfile or die "Unable to open $logfile for writing - $!"; - + + open my $file, '>>', $logfile or croak "Unable to open $logfile for writing - $!"; + print $file "DEBUG: $msg\n"; - - close $file; + + close $file; + + return; } # _debug sub ssh { @@ -500,6 +502,10 @@ Returns: # Close any prior opened sessions $self->logoff if ($self->{handle}); + # Check to see if this machines is known in DNS. If not then the chance is + # good that we will not be able to log in + return unless gethostbyname $self->{host}; + my $remote; if ($self->{protocol}) { @@ -567,7 +573,7 @@ Returns: } # logoff sub new { - my ($class) = shift; + my ($class, %parms) = @_; =pod @@ -632,8 +638,6 @@ Returns: =cut - my %parms = @_; - my $self = {}; $self->{host} = $parms{host} ? $parms{host} : 'localhost';