[perl-Gtk3] Correctly handle internal errors on perl < 5.14
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Correctly handle internal errors on perl < 5.14
- Date: Sat, 7 Jan 2012 23:17:42 +0000 (UTC)
commit 36357d029edc3d3d64d5c5331718e783b1f35db8
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Sun Jan 8 00:16:29 2012 +0100
Correctly handle internal errors on perl < 5.14
Prior to perl 5.14, using "local $@" and throwing an exception in the
same lexical scope would result in $@ containing its original value, not
the thrown exception. Our code for Gtk3::(List|Tree)Store::new and
::set has this problem. Shuffle things around a bit to please all
perls.
This fixes two common failures in t/overrides.t.
https://rt.cpan.org/Ticket/Display.html?id=73674
lib/Gtk3.pm | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 050242d..272327e 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -257,10 +257,13 @@ sub Gtk3::Window::new {
sub _common_tree_model_new {
my ($package, $class, @types) = @_;
- local $@;
- my $real_types = (@types == 1 && eval { @{$types[0]} })
- ? $types[0]
- : \ types;
+ my $real_types;
+ {
+ local $@;
+ $real_types = (@types == 1 && eval { @{$types[0]} })
+ ? $types[0]
+ : \ types;
+ }
return Glib::Object::Introspection->invoke (
$_GTK_BASENAME, $package, 'new',
$class, $real_types);
@@ -269,8 +272,13 @@ sub _common_tree_model_new {
sub _common_tree_model_set {
my ($package, $model, $iter, @columns_and_values) = @_;
my (@columns, @values);
- local $@;
- if (@columns_and_values == 2 && eval { @{$columns_and_values[0]} }) {
+ my $have_array_refs;
+ {
+ local $@;
+ $have_array_refs =
+ @columns_and_values == 2 && eval { @{$columns_and_values[0]} };
+ }
+ if ($have_array_refs) {
@columns = @{$columns_and_values[0]};
@values = @{$columns_and_values[1]};
} elsif (@columns_and_values % 2 == 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]