[perl-Glib-Object-Introspection] Do not use empty prototypes for constants subs



commit 828988575f9c321d368cb0fe0f31505f2f9449e4
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sun Apr 22 13:42:05 2012 +0200

    Do not use empty prototypes for constants subs
    
    This caused failures with perl 5.8.9.  Also, according to perlsub, it is
    not safe to override subs that are declared constant via an empty
    prototype.

 NEWS                             |    1 +
 lib/Glib/Object/Introspection.pm |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 5912d25..e0d6012 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Overview of changes in Glib::Object::Introspection <next>
 ========================================================
 
 * When looking up GTypes, also try by name.
+* Make constants work on perl 5.8.x.
 
 Overview of changes in Glib::Object::Introspection 0.007
 ========================================================
diff --git a/lib/Glib/Object/Introspection.pm b/lib/Glib/Object/Introspection.pm
index abb51b7..02171ae 100644
--- a/lib/Glib/Object/Introspection.pm
+++ b/lib/Glib/Object/Introspection.pm
@@ -111,10 +111,10 @@ sub setup {
       : $auto_name;
     # Install a sub which, on the first invocation, calls _fetch_constant and
     # then overrides itself with a constant sub returning that value.
-    *{$corrected_name} = sub () {
+    *{$corrected_name} = sub {
       my $value = __PACKAGE__->_fetch_constant($basename, $name);
       {
-        *{$corrected_name} = sub () { $value };
+        *{$corrected_name} = sub { $value };
       }
       return $value;
     };



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