[libglib-object-introspection-perl] 06/07: Hook up the generic Glib::Boxed constructor on load, not in setup()
Intrigeri
intrigeri at moszumanska.debian.org
Mon Apr 27 09:09:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to annotated tag rel-0-02-9
in repository libglib-object-introspection-perl.
commit 36f40d290188c17b3a2032aadc72ba07046f857e
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date: Fri Mar 6 17:37:20 2015 +0100
Hook up the generic Glib::Boxed constructor on load, not in setup()
It is not useful to call it before setup(), but conceptually it is independent
of setup().
---
lib/Glib/Object/Introspection.pm | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/lib/Glib/Object/Introspection.pm b/lib/Glib/Object/Introspection.pm
index f1af35f..c03fffa 100644
--- a/lib/Glib/Object/Introspection.pm
+++ b/lib/Glib/Object/Introspection.pm
@@ -153,25 +153,6 @@ sub setup {
}
}
- # Monkey-patch Glib with a generic constructor for boxed types. Glib cannot
- # provide this on its own because it does not know how big the struct of a
- # boxed type is. FIXME: This sort of violates encapsulation.
- {
- if (! defined &{Glib::Boxed::new}) {
- *{Glib::Boxed::new} = sub {
- my ($class, @rest) = @_;
- my $boxed = Glib::Object::Introspection->_construct_boxed ($class);
- my $fields = 1 == @rest ? $rest[0] : { @rest };
- foreach my $field (keys %$fields) {
- if ($boxed->can ($field)) {
- $boxed->$field ($fields->{$field});
- }
- }
- return $boxed;
- }
- }
- }
-
foreach my $name (@{$interfaces}) {
my $adder_name = $package . '::' . $name . '::_ADD_INTERFACE';
*{$adder_name} = sub {
@@ -256,6 +237,25 @@ sub INIT {
@OBJECT_PACKAGES_WITH_VFUNCS = ();
}
+# Monkey-patch Glib with a generic constructor for boxed types. Glib cannot
+# provide this on its own because it does not know how big the struct of a
+# boxed type is. FIXME: This sort of violates encapsulation.
+{
+ if (! defined &{Glib::Boxed::new}) {
+ *{Glib::Boxed::new} = sub {
+ my ($class, @rest) = @_;
+ my $boxed = Glib::Object::Introspection->_construct_boxed ($class);
+ my $fields = 1 == @rest ? $rest[0] : { @rest };
+ foreach my $field (keys %$fields) {
+ if ($boxed->can ($field)) {
+ $boxed->$field ($fields->{$field});
+ }
+ }
+ return $boxed;
+ }
+ }
+}
+
package Glib::Object::Introspection::_FuncWrapper;
use overload
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-object-introspection-perl.git
More information about the Pkg-perl-cvs-commits
mailing list