[perl-Glib-Object-Introspection] Let users specify a list of class static methods



commit 8a2d8fbaa5ef53efac915ad53afb7b95ae9e8a97
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Apr 25 19:55:15 2010 +0200

    Let users specify a list of class static methods
    
    For these, the first argument--supposedly the class name--is stripped
    off before invoking the real function.

 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 5d8df41..3a62d9b 100644
--- a/lib/Glib/Object/Introspection.pm
+++ b/lib/Glib/Object/Introspection.pm
@@ -31,6 +31,9 @@ sub setup {
   my $version = $params{version};
   my $package = $params{package};
   my $name_corrections = $params{name_corrections} || {};
+  my $class_static_methods = $params{class_static_methods} || [];
+
+  my %shift_package_name_for = map { $_ => 1 } @$class_static_methods;
 
   my $functions =
     __PACKAGE__->register_types($basename, $version, $package);
@@ -47,6 +50,7 @@ sub setup {
         ? $name_corrections->{$auto_name}
         : $auto_name;
       *{$corrected_name} = sub {
+        shift if $shift_package_name_for{$corrected_name};
         __PACKAGE__->invoke($basename,
                             $is_namespaced ? $namespace : undef,
                             $name,



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