Removed /usr/local from CDPATH
[clearscm.git] / lib / Rexec.pm
index 71fdd22..2eecab8 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 {
@@ -237,7 +239,7 @@ sub ssh {
 
   if ($logged_in) {
     # It's always hard to find the prompt. So let's make a distintive one
-    $self->{prompt} = '@@@';
+    $self->{prompt} = "\n@@@";
     $self->{handle} = $remote;
 
     # OK this is real tricky. If we call execute with a command of PS1=@@@
@@ -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';