Subject: | shell dies when sourcing bad file name |
Hello,
I just discovered and patched what I think is a bug in W::M::S. I had started a session with the plan to eventually use "history" to make a script. I tried to "source" a file, but got the file name wrong. Instead of getting the prompt back to try again, the program exited and my "history" data was lost.
Here's a patch that addresses that case:
--- Shell.pm.orig Tue May 6 16:06:42 2003
+++ Shell.pm Tue May 6 16:09:08 2003
@@ -874,7 +874,12 @@
sub run_source {
my ($self,$file) = @_;
if ($file) {
- $self->source_file($file);
+ eval {
+ $self->source_file($file);
+ };
+ if ($@) {
+ print "Could not source file: $@";
+ }
} else {
print "Syntax: source FILENAME\n";
};
#####
Unrelated, I'm getting a warning when running the recommended script. Here's a screenshot:
mark@nollie> wwwshell
Use of uninitialized value in concatenation (.) or string at /usr/local/lib/perl5/site_perl/5.8.0/WWW/Mechanize/Shell.pm line 268.
Show quoted text
>source wrong
Could not source file: Couldn't open 'wrong' : No such file or directory
Use of uninitialized value in concatenation (.) or string at /usr/local/lib/perl5/site_perl/5.8.0/WWW/Mechanize/Shell.pm line 268.
Show quoted text>
####
(This is with my patch applied, which is why it recovered).