Revision history for Perl extension Class-MOP.
+ * Class::MOP::Package
+ - alter symbol table handling to deal with 5.8.x and 5.9.x
+ * t/
+ Get rid of the crappy workaround from 0.40/41
+
0.41 Sun. July 15, 2007
* t/
Arghh!!! My TODO test didn't work, so I handle
- adding POD documentation to the examples
0.01 Thurs Feb. 2, 2006
- - Initial release
\ No newline at end of file
+ - Initial release
# this. Which of course means that
# if you put \undef in your scalar
# then this is broken.
-
- if ($type eq 'SCALAR') {
+
+ if (ref($self->namespace->{$name}) eq 'SCALAR') {
+ return ($type eq 'CODE' ? 1 : 0);
+ }
+ elsif ($type eq 'SCALAR') {
my $val = *{$self->namespace->{$name}}{$type};
- defined(${$val}) ? 1 : 0;
+ return defined(${$val}) ? 1 : 0;
}
else {
defined(*{$self->namespace->{$name}}{$type}) ? 1 : 0;
$self->add_package_symbol($variable)
unless exists $self->namespace->{$name};
- return *{$self->namespace->{$name}}{$type};
+
+ if (ref($self->namespace->{$name}) eq 'SCALAR') {
+ if ($type eq 'CODE') {
+ no strict 'refs';
+ return \&{$self->name.'::'.$name};
+ }
+ else {
+ return undef;
+ }
+ }
+ else {
+ return *{$self->namespace->{$name}}{$type};
+ }
}
sub remove_package_symbol {
# type (SCALAR|ARRAY|HASH|CODE)
my $namespace = $self->namespace;
return grep {
- defined(*{$namespace->{$_}}{$type_filter})
- } grep {
- ref(\$namespace->{$_}) eq 'GLOB'
+ (ref($namespace->{$_})
+ ? (ref($namespace->{$_}) eq 'SCALAR' && $type_filter eq 'CODE')
+ : (ref(\$namespace->{$_}) eq 'GLOB'
+ && defined(*{$namespace->{$_}}{$type_filter})));
} keys %{$namespace};
}
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-=cut
\ No newline at end of file
+=cut
# now check all our other items ...
-if ($Foo->has_method('FOO_CONSTANT')) {
- pass('... Foo->has_method(FOO_CONSTANT) (defined w/ use constant)');
-}
-else {
- diag(q{
- FIXME:
- You are using bleadperl or 5.9.5 which handles constants
- in a differnt way then prior versions of perl. This will
- cause this test to break, but the test it not critical
- to the operation of this module, so I am letting pass
- with a big FIXME note until I have the tuits to install
- 5.9.5 and fix it.
-
- Of course, patches are *always* welcome :) });
- pass('... FIXME: Foo->has_method(FOO_CONSTANT) (defined w/ use constant)');
-}
+ok($Foo->has_method('FOO_CONSTANT'), '... Foo->has_method(FOO_CONSTANT) (defined w/ use constant)');
ok($Foo->has_method('bar'), '... Foo->has_method(bar) (defined in Foo)');
ok($Foo->has_method('baz'), '... Foo->has_method(baz) (typeglob aliased within Foo)');
ok($Foo->has_method('floob'), '... Foo->has_method(floob) (defined in Foo:: using symbol tables and Sub::Name w/out package name)');