Revision history for Perl extension Class-MOP.
+0.65
+ * Class::MOP::Method
+ - Added name and package_name XS accessors, and make sure all
+ the XS and Perl versions work the same way. (Dave Rolsky)
+
+ * MOP.xs
+ - The XS versions of various methods just returned undef when
+ called class methods, rather than dying like the pure Perl
+ versions. (Dave Rolsky)
+
0.64_07 Fri August 29, 2008
* Class::MOP
- Silenced warnings that managed to break Moose tests when XS
SV *type_filter = NULL;
register HE *he;
PPCODE:
+ if (! SvROK(self)) {
+ die("Cannot call get_all_package_symbols as a class method");
+ }
switch ( GIMME_V ) {
case G_VOID: return; break;
PUTBACK;
- if (SvROK(self) && (he = hv_fetch_ent((HV *)SvRV(self), key_package, 0, hash_package)))
+ if (he = hv_fetch_ent((HV *)SvRV(self), key_package, 0, hash_package))
stash = gv_stashsv(HeVAL(he),0);
if ( stash ) {
PREINIT:
register HE *he;
PPCODE:
- if (SvROK(self) && (he = hv_fetch_ent((HV *)SvRV(self), key_package, 0, hash_package)))
+ if (! SvROK(self)) {
+ die("Cannot call name as a class method");
+ }
+
+ if (he = hv_fetch_ent((HV *)SvRV(self), key_package, 0, hash_package))
XPUSHs(HeVAL(he));
else
ST(0) = &PL_sv_undef;
PREINIT:
register HE *he;
PPCODE:
- if (SvROK(self) && (he = hv_fetch_ent((HV *)SvRV(self), key_name, 0, hash_name)))
+ if (! SvROK(self)) {
+ die("Cannot call name as a class method");
+ }
+
+ if (he = hv_fetch_ent((HV *)SvRV(self), key_name, 0, hash_name))
XPUSHs(HeVAL(he));
else
ST(0) = &PL_sv_undef;
use Scalar::Util 'reftype', 'blessed';
-use Test::More tests => 101;
+use Test::More tests => 100;
use Test::Exception;
-BEGIN {
- use_ok('Class::MOP');
- use_ok('Class::MOP::Attribute');
-}
+use Class::MOP;
+use Class::MOP::Attribute;
+
+
+dies_ok { Class::MOP::Attribute->name } q{... can't call name() as a class method};
+
{
my $attr = Class::MOP::Attribute->new('$foo');
use Test::More tests => 97;
use Test::Exception;
-BEGIN {
- use_ok('Class::MOP');
- use_ok('Class::MOP::Package');
-}
+use Class::MOP;
+use Class::MOP::Package;
+
+
+dies_ok { Class::MOP::Package->get_all_package_symbols } q{... can't call get_all_package_symbols() as a class method};
+dies_ok { Class::MOP::Package->name } q{... can't call name() as a class method};
{
package Foo;