Merge branch 'master' of defaria.com:/opt/git/clearscm
[clearscm.git] / lib / Rexec.pm
index 71fdd22..6db5735 100644 (file)
@@ -160,16 +160,18 @@ our @EXPORT = qw (
 
 my @lines;
 
-sub _debug ($) {\r
+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;\r
+
+  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';