Fix abnormal program end at empty string input Fix parse error with empty input line Fix for general parse errors --- ./lib/Net/LDAP/Shell.pm 2006-06-27 12:01:32 +0400 +++ ./lib/Net/LDAP/Shell.pm 2006-06-27 12:05:32 +0400 @@ -395,7 +395,12 @@ my $shell = shift or die error("parse called without shell"); my $line = shift; debug("parsing [$line]"); - return Net::LDAP::Shell::Parse::parse($line); + my $ret; + unless (eval{$ret=Net::LDAP::Shell::Parse::parse($line); 1;}) { + print "General parse error for line '$line'\n"; + $ret=''; + } + return $ret; } =cut @@ -492,10 +492,11 @@ sub run { my $shell = shift or die error("run called without shell"); my $line; + $line=""; #while ($line = ) { #while ($line = $shell->{'TERM'}->readline($shell->prompt())) { #print "prompt is '$str'\n"; - $line = $shell->{'TERM'}->readline($shell->prompt()); + #$line = $shell->{'TERM'}->readline($shell->prompt()); #$shell->{'TERM'}->addhistory($line); while (defined $line) { if ($line) { @@ -504,7 +505,10 @@ #chomp $line; $shell->parse($line); #$shell->prompt(); - $line = $shell->{'TERM'}->readline($shell->prompt()); + unless(eval{$line = $shell->{'TERM'}->readline($shell->prompt());}) { + print "\n"; + $line=""; + } } $shell->{'CONFIG'}->{'ldap'}->unbind; } --- ./lib/Net/LDAP/Shell/Parse.pm 2004-11-24 09:07:44 +0300 +++ ./lib/Net/LDAP/Shell/Parse.pm 2006-06-15 01:20:23 +0400 @@ -108,7 +108,8 @@ my ($class,$obj,$objlist,$ref,$file,@lines,$comment,$refclass); $line = shift; - + return '' unless ($line); + #my $typehandle = new FileHandle $file, "r" or # die "Could not open $file: $!\n";