perl-Glib r1055 - in trunk: . t
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Glib r1055 - in trunk: . t
- Date: Tue, 30 Dec 2008 14:12:38 +0000 (UTC)
Author: tsch
Date: Tue Dec 30 14:12:37 2008
New Revision: 1055
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1055&view=rev
Log:
Allow calling Glib::Flags::as_arrayref directly, as an alternative to the @{}
syntax. Patch by Kevin Ryde.
Modified:
trunk/ChangeLog
trunk/GType.xs
trunk/t/c.t
Modified: trunk/GType.xs
==============================================================================
--- trunk/GType.xs (original)
+++ trunk/GType.xs Tue Dec 30 14:12:37 2008
@@ -2776,14 +2776,18 @@
RETVAL
=for apidoc
-=for arg b (SV*)
-=for arg swap (integer)
+=for signature ref = $a->as_arrayref
+=for arg ... (__hide__)
=cut
SV *
-as_arrayref (SV *a, b, swap)
+as_arrayref (SV *a, ...)
PROTOTYPE: $;@
CODE:
{
+ /* overload @{} calls here with the usual three args "a,b,swap", but
+ * "b" and "swap" have no meaning. Using "..." to ignore them lets
+ * users call method-style with no args "$f->as_arrayref" too.
+ */
GType gtype;
const char *package;
gint a_;
Modified: trunk/t/c.t
==============================================================================
--- trunk/t/c.t (original)
+++ trunk/t/c.t Tue Dec 30 14:12:37 2008
@@ -13,7 +13,7 @@
#########################
-use Test::More tests => 34;
+use Test::More tests => 35;
BEGIN { use_ok('Glib') };
#########################
@@ -216,6 +216,7 @@
is ($obj->get ('some_enum'), 'value-two', 'enum property, after set');
is_deeply (\ { $obj->get ('some_flags') }, ['value-one'], 'flags property');
+is_deeply ($obj->get('some_flags')->as_arrayref, ['value-one'], 'flags property');
$obj->set (some_flags => ['value-one', 'value-two']);
is_deeply (\ { $obj->get ('some_flags') }, ['value-one', 'value-two'],
'flags property, after set');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]