From: Stevan Little Date: Sun, 8 Apr 2007 03:53:11 +0000 (+0000) Subject: I think this fixed the bleadperl issue X-Git-Tag: 0_38~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=823a5d313b1973a47b951dd60599b36af8093345;p=gitmo%2FClass-MOP.git I think this fixed the bleadperl issue --- diff --git a/Changes b/Changes index c44e5c4..2ecf56f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension Class-MOP. +0.38 + ~~ More documentation updates ~~ + * Class::MOP::Package + - we now deal with stub methods properly + - added tests for this + 0.37 Sat. March 10, 2007 ~~ Many, many documentation updates ~~ diff --git a/README b/README index ad3f01d..bdbb05e 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Class::MOP version 0.37 +Class::MOP version 0.38 =========================== See the individual module documentation for more information diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 3e61675..485f797 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -13,7 +13,7 @@ use Class::MOP::Method; use Class::MOP::Immutable; -our $VERSION = '0.37'; +our $VERSION = '0.38'; our $AUTHORITY = 'cpan:STEVAN'; { diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index aaf904f..cbd80de 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -13,7 +13,7 @@ use Scalar::Util 'blessed', 'reftype', 'weaken'; use Sub::Name 'subname'; use B 'svref_2object'; -our $VERSION = '0.21'; +our $VERSION = '0.22'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Module'; @@ -864,6 +864,10 @@ This will create an anonymous class, it works much like C but it does not need a C<$package_name>. Instead it will create a suitably unique package name for you to stash things into. +On very important distinction is that anon classes are destroyed once +the metaclass they are attached to goes out of scope. In the DESTROY +method, the created package will be removed from the symbol table. + =item B This initializes and returns returns a B object diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 15ccfd6..62c9e15 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -7,7 +7,7 @@ use warnings; use Scalar::Util 'blessed'; use Carp 'confess'; -our $VERSION = '0.05'; +our $VERSION = '0.06'; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Object'; @@ -195,6 +195,8 @@ sub list_all_package_symbols { my $namespace = $self->namespace; return grep { defined(*{$namespace->{$_}}{$type_filter}) + } grep { + ref(\$namespace->{$_}) eq 'GLOB' } keys %{$namespace}; } diff --git a/t/003_methods.t b/t/003_methods.t index 91399cf..fa64c49 100644 --- a/t/003_methods.t +++ b/t/003_methods.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 64; +use Test::More tests => 66; use Test::Exception; use Scalar::Util qw/reftype/; @@ -21,6 +21,9 @@ BEGIN { # import a sub use Scalar::Util 'blessed'; + sub pie; + sub cake (); + use constant FOO_CONSTANT => 'Foo-CONSTANT'; # define a sub in package @@ -56,6 +59,9 @@ BEGIN { my $Foo = Class::MOP::Class->initialize('Foo'); +ok(!$Foo->has_method('pie'), '... got the method stub pie'); +ok(!$Foo->has_method('cake'), '... got the constant method stub cake'); + my $foo = sub { 'Foo::foo' }; ok(!UNIVERSAL::isa($foo, 'Class::MOP::Method'), '... our method is not yet blessed');