[perl-Glib-Object-Introspection] Do not overwrite existing subs when installing stubs



commit 2b059108a63ff12c52f19057d7e4f3dfa31c3635
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Tue Aug 23 00:36:46 2011 +0200

    Do not overwrite existing subs when installing stubs
    
    This is to allow other modules to provide custom overrides.

 lib/Glib/Object/Introspection.pm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/lib/Glib/Object/Introspection.pm b/lib/Glib/Object/Introspection.pm
index 2887797..b1af5af 100644
--- a/lib/Glib/Object/Introspection.pm
+++ b/lib/Glib/Object/Introspection.pm
@@ -49,6 +49,7 @@ sub setup {
 
   foreach my $namespace (keys %{$functions}) {
     my $is_namespaced = $namespace ne "";
+    NAME:
     foreach my $name (@{$functions->{$namespace}}) {
       my $auto_name = $is_namespaced
         ? $package . '::' . $namespace . '::' . $name
@@ -56,6 +57,9 @@ sub setup {
       my $corrected_name = exists $name_corrections->{$auto_name}
         ? $name_corrections->{$auto_name}
         : $auto_name;
+      if (defined *{$corrected_name}) {
+        next NAME;
+      }
       *{$corrected_name} = sub {
         shift if $shift_package_name_for{$corrected_name};
         __PACKAGE__->_invoke($basename,



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