[gimp-perl] Handle stringification error.



commit 95b561eda1e61988dd4714ff45dd1b4aca25033b
Author: Ed J <edj src gnome org>
Date:   Mon May 26 07:35:58 2014 +0100

    Handle stringification error.

 examples/Perl-Console |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/examples/Perl-Console b/examples/Perl-Console
index fadab7c..0e624c8 100755
--- a/examples/Perl-Console
+++ b/examples/Perl-Console
@@ -114,7 +114,13 @@ sub process_input {
   my ($input)= @_;
   $input = 'Gtk2->main_quit' if $input eq 'exit';
   my @out = eval("no strict;no warnings;\n#line 1 \"code\"\n".$input);
-  my $output = $@ || join ' ', map { $_ // '(undef)' } @out;
+  my $output;
+  if ($@) {
+    $output = $@;
+  } else {
+    $output = eval { join ' ', map { $_ // '(undef)' } @out; };
+    $output = "Error stringifying output: $@" if $@;
+  }
   chomp $output;
   "> $input\n$output";
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]