From 302422b968e307cc67ff1566ced3a964c4a37a71 Mon Sep 17 00:00:00 2001 From: pdbogen Date: Wed, 2 Feb 2011 20:01:59 +0000 Subject: [PATCH] Handle blank queries. Fix typo in error handling. Workaround IMDB::Film bug that causes error messages to build up despite multiple instantiations. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@114 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands.yaml b/commands.yaml index 29a0d27..d10a198 100644 --- a/commands.yaml +++ b/commands.yaml @@ -2118,10 +2118,14 @@ IMDB: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; use IMDB::Film; - my $imdb = new IMDB::Film( crit => $what ); + if( $what =~ /^\s*$/ ) { + $kernel->post( $src, $replypath, "Usage: IMDB ", $dest ); + return; + } + my $imdb = new IMDB::Film( crit => $what, error => [] ); if( $imdb->status ) { $kernel->post( $src, $replypath, $imdb->title()." (".$imdb->year()."): ".join( ', ', @{ $imdb->genres() } )."; Rating ".(scalar $imdb->rating()).": ".$imdb->storyline(), $dest ); } else { - $kernel-post( $src, $replypath, "An error occured: ".$imdb->error, $dest ); + $kernel->post( $src, $replypath, "An error occured: ".$imdb->error(), $dest ); } } -- 2.11.0