Hello community,
here is the log from the commit of package perl-Class-XSAccessor for
openSUSE:Factory checked in at 2013-07-30 16:37:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Class-XSAccessor (Old)
and /work/SRC/openSUSE:Factory/.perl-Class-XSAccessor.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Class-XSAccessor"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Class-XSAccessor/perl-Class-XSAccessor.changes
2013-06-05 17:48:57.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Class-XSAccessor.new/perl-Class-XSAccessor.changes
2013-07-30 16:37:25.000000000 +0200
@@ -1,0 +2,14 @@
+Sat Jul 27 11:58:18 UTC 2013 - [email protected]
+
+- updated to 1.18
+ - Revert fixes for implicitly-lvalue getters for now since that
+ actually breaks user code. It seems it's not just because the
+ users are naughty, so more investigation required.
+ - For Hashes: Implement predicates that check definedness and
+ existance explicitly. The traditional "predicates" check
+ definedness. It's conceivable to also want a bool-check
+ type predicate. File a ticket if you need that.
+ - Fix bug regarding getters being implicitly lvalue by
+ returning the internal SV*. Instead, we now use TARG.
+
+-------------------------------------------------------------------
Old:
----
Class-XSAccessor-1.16.tar.gz
New:
----
Class-XSAccessor-1.18.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Class-XSAccessor.spec ++++++
--- /var/tmp/diff_new_pack.KjVQEu/_old 2013-07-30 16:37:26.000000000 +0200
+++ /var/tmp/diff_new_pack.KjVQEu/_new 2013-07-30 16:37:26.000000000 +0200
@@ -17,7 +17,7 @@
Name: perl-Class-XSAccessor
-Version: 1.16
+Version: 1.18
Release: 0
%define cpan_name Class-XSAccessor
Summary: Generate fast XS accessors without runtime compilation
@@ -37,10 +37,11 @@
%description
Class::XSAccessor implements fast read, write and read/write accessors in
XS. Additionally, it can provide predicates such as 'has_foo()' for testing
-whether the attribute 'foo' is defined in the object. It only works with
-objects that are implemented as ordinary hashes. the
-Class::XSAccessor::Array manpage implements the same interface for objects
-that use arrays for their internal representation.
+whether the attribute 'foo' exists in the object (which is different from
+"is defined within the object"). It only works with objects that are
+implemented as ordinary hashes. the Class::XSAccessor::Array manpage
+implements the same interface for objects that use arrays for their
+internal representation.
Since version 0.10, the module can also generate simple constructors
(implemented in XS). Simply supply the 'constructor => 'constructor_name''
@@ -76,6 +77,11 @@
hierarchy with interfaces such as the PPI manpage. These methods are
provided by the 'true' and 'false' options - see the synopsis.
+'defined_predicates' check whether a given object attribute is defined.
+'predicates' is an alias for 'defined_predicates' for compatibility with
+older versions of 'Class::XSAccessor'. 'exists_predicates' checks whether
+the given attribute exists in the object using 'exists'.
+
%prep
%setup -q -n %{cpan_name}-%{version}
++++++ Class-XSAccessor-1.16.tar.gz -> Class-XSAccessor-1.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/Changes
new/Class-XSAccessor-1.18/Changes
--- old/Class-XSAccessor-1.16/Changes 2012-11-05 13:47:26.000000000 +0100
+++ new/Class-XSAccessor-1.18/Changes 2013-06-17 18:08:31.000000000 +0200
@@ -1,5 +1,18 @@
Revision history for Perl extension Class-XSAccessor.
+1.18 Mon Jun 17 18:07 2013
+ - Revert fixes for implicitly-lvalue getters for now since that
+ actually breaks user code. It seems it's not just because the
+ users are naughty, so more investigation required.
+
+1.17 Mon Jun 17 07:09 2013
+ - For Hashes: Implement predicates that check definedness and
+ existance explicitly. The traditional "predicates" check
+ definedness. It's conceivable to also want a bool-check
+ type predicate. File a ticket if you need that.
+ - Fix bug regarding getters being implicitly lvalue by
+ returning the internal SV*. Instead, we now use TARG.
+
1.16 Mon Nov 5 13:47 2012
- Drop erroneous MYMETA files from distribution.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/META.json
new/Class-XSAccessor-1.18/META.json
--- old/Class-XSAccessor-1.16/META.json 2012-11-05 13:49:47.000000000 +0100
+++ new/Class-XSAccessor-1.18/META.json 2013-06-17 18:09:04.000000000 +0200
@@ -4,7 +4,7 @@
"Steffen Mueller <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter
version 2.120921",
+ "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter
version 2.120921",
"license" : [
"perl_5"
],
@@ -43,5 +43,5 @@
"url" : "git://github.com/tsee/Class-XSAccessor.git"
}
},
- "version" : "1.16"
+ "version" : "1.18"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/META.yml
new/Class-XSAccessor-1.18/META.yml
--- old/Class-XSAccessor-1.16/META.yml 2012-11-05 13:49:46.000000000 +0100
+++ new/Class-XSAccessor-1.18/META.yml 2013-06-17 18:09:04.000000000 +0200
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version
2.120921'
+generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version
2.120921'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,4 +22,4 @@
perl: 5.008
resources:
repository: git://github.com/tsee/Class-XSAccessor.git
-version: 1.16
+version: 1.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/XS/Array.xs
new/Class-XSAccessor-1.18/XS/Array.xs
--- old/Class-XSAccessor-1.16/XS/Array.xs 2012-11-04 15:05:21.000000000
+0100
+++ new/Class-XSAccessor-1.18/XS/Array.xs 2013-06-17 18:01:52.000000000
+0200
@@ -352,7 +352,7 @@
case 1: /* newxs_lvalue_accessor */
{
CV* cv;
- INSTALL_NEW_CV_ARRAY_OBJ(name, CXAA(getter_init), index);
+ INSTALL_NEW_CV_ARRAY_OBJ(name, CXAA(lvalue_accessor_init), index);
/* Make the CV lvalue-able. "cv" was set by the previous macro */
CvLVALUE_on(cv);
break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/XS/Hash.xs
new/Class-XSAccessor-1.18/XS/Hash.xs
--- old/Class-XSAccessor-1.16/XS/Hash.xs 2012-11-04 15:15:32.000000000
+0100
+++ new/Class-XSAccessor-1.18/XS/Hash.xs 2013-06-17 18:01:52.000000000
+0200
@@ -1,12 +1,22 @@
#include "ppport.h"
## we want hv_fetch but with the U32 hash argument of hv_fetch_ent, so do it
ourselves...
+
#ifdef hv_common_key_len
-#define CXSA_HASH_FETCH(hv, key, len, hash) hv_common_key_len((hv), (key),
(len), HV_FETCH_JUST_SV, NULL, (hash))
-#define CXSA_HASH_FETCH_LVALUE(hv, key, len, hash) hv_common_key_len((hv),
(key), (len), (HV_FETCH_JUST_SV|HV_FETCH_LVALUE), NULL, (hash))
+
+# define CXSA_HASH_FETCH(hv, key, len, hash) \
+ hv_common_key_len((hv), (key), (len), HV_FETCH_JUST_SV, NULL, (hash))
+# define CXSA_HASH_FETCH_LVALUE(hv, key, len, hash) \
+ hv_common_key_len((hv), (key), (len),
(HV_FETCH_JUST_SV|HV_FETCH_LVALUE), NULL, (hash))
+# define CXSA_HASH_EXISTS(hv, key, len, hash) \
+ hv_common_key_len((hv), (key), (len), HV_FETCH_ISEXISTS, NULL, (hash))
+
#else
-#define CXSA_HASH_FETCH(hv, key, len, hash) hv_fetch((hv), (key), (len), 0)
-#define CXSA_HASH_FETCH_LVALUE(hv, key, len, hash) hv_fetch((hv), (key),
(len), 1)
+
+# define CXSA_HASH_FETCH(hv, key, len, hash) hv_fetch((hv), (key), (len), 0)
+# define CXSA_HASH_FETCH_LVALUE(hv, key, len, hash) hv_fetch((hv), (key),
(len), 1)
+# define CXSA_HASH_EXISTS(hv, key, len, hash) hv_exists((hv), (key), (len))
+
#endif
@@ -243,7 +253,34 @@
}
void
-predicate_init(self)
+exists_predicate_init(self)
+ SV* self;
+ INIT:
+ /* Get the const hash key struct from the global storage */
+ const autoxs_hashkey * readfrom = CXAH_GET_HASHKEY;
+ PPCODE:
+ CXA_CHECK_HASH(self);
+ CXAH_OPTIMIZE_ENTERSUB(exists_predicate);
+ if ( CXSA_HASH_EXISTS((HV *)SvRV(self), readfrom->key, readfrom->len,
readfrom->hash) != NULL )
+ XSRETURN_YES;
+ else
+ XSRETURN_NO;
+
+void
+exists_predicate(self)
+ SV* self;
+ INIT:
+ /* Get the const hash key struct from the global storage */
+ const autoxs_hashkey * readfrom = CXAH_GET_HASHKEY;
+ PPCODE:
+ CXA_CHECK_HASH(self);
+ if ( CXSA_HASH_EXISTS((HV *)SvRV(self), readfrom->key, readfrom->len,
readfrom->hash) != NULL )
+ XSRETURN_YES;
+ else
+ XSRETURN_NO;
+
+void
+defined_predicate_init(self)
SV* self;
INIT:
/* Get the const hash key struct from the global storage */
@@ -251,14 +288,14 @@
SV** svp;
PPCODE:
CXA_CHECK_HASH(self);
- CXAH_OPTIMIZE_ENTERSUB(predicate);
+ CXAH_OPTIMIZE_ENTERSUB(defined_predicate);
if ( ((svp = CXSA_HASH_FETCH((HV *)SvRV(self), readfrom->key,
readfrom->len, readfrom->hash))) && SvOK(*svp) )
XSRETURN_YES;
else
XSRETURN_NO;
void
-predicate(self)
+defined_predicate(self)
SV* self;
INIT:
/* Get the const hash key struct from the global storage */
@@ -271,6 +308,7 @@
else
XSRETURN_NO;
+
void
constructor_init(class, ...)
SV* class;
@@ -419,6 +457,8 @@
ALIAS:
Class::XSAccessor::newxs_lvalue_accessor = 1
Class::XSAccessor::newxs_predicate = 2
+ Class::XSAccessor::newxs_defined_predicate = 3
+ Class::XSAccessor::newxs_exists_predicate = 4
PREINIT:
char *name;
char *key;
@@ -438,7 +478,11 @@
}
break;
case 2:
- INSTALL_NEW_CV_HASH_OBJ(name, CXAH(predicate_init), key, keylen);
+ case 3:
+ INSTALL_NEW_CV_HASH_OBJ(name, CXAH(defined_predicate_init), key, keylen);
+ break;
+ case 4:
+ INSTALL_NEW_CV_HASH_OBJ(name, CXAH(exists_predicate_init), key, keylen);
break;
default:
croak("Invalid alias of newxs_getter called");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/XSAccessor.xs
new/Class-XSAccessor-1.18/XSAccessor.xs
--- old/Class-XSAccessor-1.16/XSAccessor.xs 2012-11-04 15:24:55.000000000
+0100
+++ new/Class-XSAccessor-1.18/XSAccessor.xs 2013-06-17 18:00:57.000000000
+0200
@@ -284,7 +284,10 @@
#define Class__XSAccessor_accessor_init Clas_XSAcesor_acesor_init
#define Class__XSAccessor_chained_accessor_init Cs_XSAs_cid_as_init
#define Class__XSAccessor_chained_accessor Clas_XSAcesor_chained_acesor
-#define Class__XSAccessor_predicate_init Clas_XSAcesor_predicate_init
+#define Class__XSAccessor_exists_predicate_init Clas_XSAcesor_eprdicate_init
+#define Class__XSAccessor_defined_predicate_init Clas_XSAcesor_dprdicate_init
+#define Class__XSAccessor_exists_predicate Clas_XSAcesor_eprdicate
+#define Class__XSAccessor_defined_predicate Clas_XSAcesor_dprdicate
#define Class__XSAccessor_constructor_init Cs_XSAs_csuor_init
#define Class__XSAccessor_constructor Class_XSAccessor_constructor
#define Class__XSAccessor_constant_false_init Cs_XSAs_csnt_fse_init
@@ -472,9 +475,13 @@
XS(CXAH(chained_accessor_init));
CXAH_GENERATE_ENTERSUB(chained_accessor);
-XS(CXAH(predicate));
-XS(CXAH(predicate_init));
-CXAH_GENERATE_ENTERSUB(predicate);
+XS(CXAH(defined_predicate));
+XS(CXAH(defined_predicate_init));
+CXAH_GENERATE_ENTERSUB(defined_predicate);
+
+XS(CXAH(exists_predicate));
+XS(CXAH(exists_predicate_init));
+CXAH_GENERATE_ENTERSUB(exists_predicate);
XS(CXAH(constructor));
XS(CXAH(constructor_init));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/lib/Class/XSAccessor/Array.pm
new/Class-XSAccessor-1.18/lib/Class/XSAccessor/Array.pm
--- old/Class-XSAccessor-1.16/lib/Class/XSAccessor/Array.pm 2012-08-26
23:25:09.000000000 +0200
+++ new/Class-XSAccessor-1.18/lib/Class/XSAccessor/Array.pm 2013-06-17
18:08:45.000000000 +0200
@@ -6,7 +6,7 @@
use Class::XSAccessor;
use Class::XSAccessor::Heavy;
-our $VERSION = '1.14';
+our $VERSION = '1.18';
sub import {
my $own_class = shift;
@@ -275,7 +275,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2008, 2009, 2010, 2011, 2012 by Steffen Mueller
+Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by Steffen Mueller
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8 or,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/lib/Class/XSAccessor/Heavy.pm
new/Class-XSAccessor-1.18/lib/Class/XSAccessor/Heavy.pm
--- old/Class-XSAccessor-1.16/lib/Class/XSAccessor/Heavy.pm 2012-08-26
23:25:01.000000000 +0200
+++ new/Class-XSAccessor-1.18/lib/Class/XSAccessor/Heavy.pm 2013-06-17
18:08:47.000000000 +0200
@@ -6,7 +6,7 @@
use warnings;
use Carp;
-our $VERSION = '1.14';
+our $VERSION = '1.18';
our @CARP_NOT = qw(
Class::XSAccessor
Class::XSAccessor::Array
@@ -66,7 +66,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2008, 2009, 2010, 2011, 2012 by Steffen Mueller
+Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by Steffen Mueller
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8 or,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/lib/Class/XSAccessor.pm
new/Class-XSAccessor-1.18/lib/Class/XSAccessor.pm
--- old/Class-XSAccessor-1.16/lib/Class/XSAccessor.pm 2012-11-05
13:49:24.000000000 +0100
+++ new/Class-XSAccessor-1.18/lib/Class/XSAccessor.pm 2013-06-17
18:08:39.000000000 +0200
@@ -6,7 +6,7 @@
use Class::XSAccessor::Heavy;
use XSLoader;
-our $VERSION = '1.16';
+our $VERSION = '1.18';
XSLoader::load('Class::XSAccessor', $VERSION);
@@ -39,6 +39,8 @@
my $acc_subs = _make_hash($opts{accessors} || {});
my $lvacc_subs = _make_hash($opts{lvalue_accessors} || {});
my $pred_subs = _make_hash($opts{predicates} || {});
+ my $ex_pred_subs = _make_hash($opts{exists_predicates} || {});
+ my $def_pred_subs = _make_hash($opts{defined_predicates} || {});
my $test_subs = _make_hash($opts{__tests__} || {});
my $construct_subs = $opts{constructors} || [defined($opts{constructor}) ?
$opts{constructor} : ()];
my $true_subs = $opts{true} || [];
@@ -49,7 +51,9 @@
["accessor", $acc_subs],
["lvalue_accessor", $lvacc_subs],
["test", $test_subs],
- ["predicate", $pred_subs] )
+ ["ex_predicate", $ex_pred_subs],
+ ["def_predicate", $def_pred_subs],
+ ["def_predicate", $pred_subs] )
{
my $subs = $subtype->[1];
foreach my $subname (keys %$subs) {
@@ -88,8 +92,11 @@
elsif ($type eq 'setter') {
newxs_setter($subname, $hashkey, $opts->{chained}||0);
}
- elsif ($type eq 'predicate') {
- newxs_predicate($subname, $hashkey);
+ elsif ($type eq 'def_predicate') {
+ newxs_defined_predicate($subname, $hashkey);
+ }
+ elsif ($type eq 'ex_predicate') {
+ newxs_exists_predicate($subname, $hashkey);
}
elsif ($type eq 'constructor') {
newxs_constructor($subname);
@@ -134,7 +141,12 @@
foo => 'foo',
bar => 'bar',
},
- predicates => {
+ # "predicates" is an alias for "defined_predicates"
+ defined_predicates => {
+ defined_foo => 'foo',
+ defined_bar => 'bar',
+ },
+ exists_predicates => {
has_foo => 'foo',
has_bar => 'bar',
},
@@ -164,7 +176,8 @@
Class::XSAccessor implements fast read, write and read/write accessors in XS.
Additionally, it can provide predicates such as C<has_foo()> for testing
-whether the attribute C<foo> is defined in the object.
+whether the attribute C<foo> exists in the object (which is different from
+"is defined within the object").
It only works with objects that are implemented as ordinary hashes.
L<Class::XSAccessor::Array> implements the same interface for objects
that use arrays for their internal representation.
@@ -206,6 +219,11 @@
with interfaces such as L<PPI>. These methods are provided by the C<true>
and C<false> options - see the synopsis.
+C<defined_predicates> check whether a given object attribute is defined.
+C<predicates> is an alias for C<defined_predicates> for compatibility with
+older versions of C<Class::XSAccessor>. C<exists_predicates> checks
+whether the given attribute exists in the object using C<exists>.
+
=head1 OPTIONS
In addition to specifying the types and names of accessors, additional options
@@ -299,7 +317,7 @@
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2008, 2009, 2010, 2011, 2012 by Steffen Mueller
+Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by Steffen Mueller
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8 or,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Class-XSAccessor-1.16/t/03hash_predicate.t
new/Class-XSAccessor-1.18/t/03hash_predicate.t
--- old/Class-XSAccessor-1.16/t/03hash_predicate.t 2010-10-31
12:32:26.000000000 +0100
+++ new/Class-XSAccessor-1.18/t/03hash_predicate.t 2013-06-17
18:00:57.000000000 +0200
@@ -4,10 +4,12 @@
package Class::XSAccessor::Test;
use Class::XSAccessor
- accessors => { bar => 'bar' },
- getters => { get_foo => 'foo', get_zero => 'zero' },
- setters => { set_foo => 'foo' },
- predicates => { has_foo => 'foo', has_bar => 'bar', has_zero => 'zero' };
+ accessors => { bar => 'bar' },
+ getters => { get_foo => 'foo', get_zero => 'zero' },
+ setters => { set_foo => 'foo' },
+ predicates => { has_foo => 'foo', has_bar => 'bar', has_zero =>
'zero' },
+ defined_predicates => { has_foo2 => 'foo', has_bar2 => 'bar', has_zero2 =>
'zero' },
+ exists_predicates => { has_baz => 'baz', has_buz => 'buz' };
use Class::XSAccessor
predicates => 'single';
@@ -16,12 +18,12 @@
sub new {
my $class = shift;
- bless { bar => 'baz', zero => 0 }, $class;
+ bless { bar => 'baz', zero => 0, buz => undef }, $class;
}
package main;
-use Test::More tests => 20;
+use Test::More tests => 29;
my $obj = Class::XSAccessor::Test->new();
@@ -29,6 +31,9 @@
ok($obj->can('has_bar'));
ok(!$obj->has_foo());
+ok(!$obj->has_foo2());
+ok(!$obj->has_baz());
+ok($obj->has_buz());
ok($obj->has_bar());
is($obj->set_foo('bar'), 'bar');
@@ -36,12 +41,24 @@
ok($obj->has_foo());
ok($obj->has_bar());
+ok($obj->has_foo2());
+ok($obj->has_bar2());
is($obj->set_foo(undef), undef);
is($obj->bar(undef), undef);
+$obj->{foo2} = undef;
+ok(!$obj->has_foo()); # undef is "doesn't have" for defined_predicates
+ok(!$obj->has_foo2()); # undef is "doesn't have" for defined_predicates
+delete $obj->{foo};
+delete $obj->{foo2};
ok(!$obj->has_foo());
-ok(!$obj->has_bar());
+ok(!$obj->has_foo2());
+
+$obj->{baz} = undef;
+ok($obj->has_baz(), "exists_predicates on undef elem is true");
+delete $obj->{baz};
+ok(!$obj->has_baz(), "exists_predicates on non-existant elem is false");
is($obj->get_zero, 0);
ok($obj->has_zero);
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]