X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP.pm;h=9d0c16e69fff9cee942501d25f67d93b93d2e05a;hb=d7bf3478fe0adfc72575b94b1c6c85fb6f95b501;hp=14afdefe8a38abded2c81c25e23498fb85ceac17;hpb=1d68af0454f55a8b088f8bc1887a0a5ce54d2a22;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 14afdef..9d0c16e 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -13,8 +13,18 @@ use Class::MOP::Method; use Class::MOP::Immutable; -our $VERSION = '0.43'; -our $AUTHORITY = 'cpan:STEVAN'; +BEGIN { + our $VERSION = '0.50'; + our $AUTHORITY = 'cpan:STEVAN'; + + use XSLoader; + XSLoader::load( 'Class::MOP', $VERSION ); + + unless ($] < 5.009_005) { + no warnings 'redefine', 'prototype'; + *check_package_cache_flag = \&mro::get_pkg_gen; + } +} { # Metaclasses are singletons, so we cache them here. @@ -405,12 +415,12 @@ Class::MOP::Attribute->meta->add_method('new' => sub { if ref $options{builder} || !(defined $options{builder}); confess("Setting both default and builder is not allowed.") if exists $options{default}; + } else { + (Class::MOP::Attribute::is_default_a_coderef(\%options)) + || confess("References are not allowed as default values, you must ". + "wrap then in a CODE reference (ex: sub { [] } and not [])") + if exists $options{default} && ref $options{default}; } - (Class::MOP::Attribute::is_default_a_coderef(\%options)) - || confess("References are not allowed as default values, you must ". - "wrap then in a CODE reference (ex: sub { [] } and not [])") - if exists $options{default} && ref $options{default}; - # return the new object $class->meta->new_object(name => $name, %options); }); @@ -732,6 +742,10 @@ NOTE: This does a basic check of the symbol table to try and determine as best it can if the C<$class_name> is loaded, it is probably correct about 99% of the time. +=item B + +=item B + =back =head2 Metaclass cache functions @@ -881,6 +895,8 @@ Rob (robkinyon) Kinyon Yuval (nothingmuch) Kogman +Scott (konobi) McWhirter + =head1 COPYRIGHT AND LICENSE Copyright 2006, 2007 by Infinity Interactive, Inc.