0.51
~~~ some misc. doc. fixes ~~~
~~ updated copyright dates ~~
+
+ * Class::MOP
+ - now sets the IS_RUNNING_ON_5_10
+ constant so that we can take advantage
+ of some of the nice bits of 5.10
+
+ * Class::MOP::Class
+ - uses the IS_RUNNING_ON_5_10 flag to
+ optimize the &linearized_isa method
+ and avoid the hack/check for circular
+ inheritence in &class_precedence_list
+
+ * Class::MOP::Immutable
+ - the immutable class now keeps track of
+ the transformer which immutablized it
0.50 Fri. Dec. 21, 2007
* Class::MOP::Class
XSLoader::load( 'Class::MOP', $VERSION );
unless ($] < 5.009_005) {
+ require mro;
no warnings 'redefine', 'prototype';
*check_package_cache_flag = \&mro::get_pkg_gen;
+ *IS_RUNNING_ON_5_10 = sub () { 1 };
+ }
+ else {
+ *IS_RUNNING_ON_5_10 = sub () { 0 };
}
}
}
sub is_class_loaded {
- my $class = shift;
- no strict 'refs';
- return 1 if defined ${"${class}::VERSION"} || defined @{"${class}::ISA"};
- foreach (keys %{"${class}::"}) {
- next if substr($_, -2, 2) eq '::';
- return 1 if defined &{"${class}::$_"};
- }
- return 0;
+ my $class = shift;
+ no strict 'refs';
+ return 1 if defined ${"${class}::VERSION"} || defined @{"${class}::ISA"};
+ foreach (keys %{"${class}::"}) {
+ next if substr($_, -2, 2) eq '::';
+ return 1 if defined &{"${class}::$_"};
+ }
+ return 0;
}
=head1 FUNCTIONS
+=head2 Constants
+
+=over 4
+
+=item I<IS_RUNNING_ON_5_10>
+
+We set this constant depending on what version perl we are on, this
+allows us to take advantage of new 5.10 features and stay backwards
+compat.
+
+=back
+
=head2 Utility functions
=over 4
use Scalar::Util 'blessed', 'reftype', 'weaken';
use Sub::Name 'subname';
-our $VERSION = '0.25';
+our $VERSION = '0.26';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Class::MOP::Module';
my $symbol_table_hashref = do { no strict 'refs'; \%{"${outer_class}::"} };
- SYMBOL:
+ SYMBOL:
for my $symbol ( keys %$symbol_table_hashref ) {
next SYMBOL if $symbol !~ /\A (\w+):: \z/x;
my $inner_class = $1;
sub linearized_isa {
- my %seen;
- grep { !($seen{$_}++) } (shift)->class_precedence_list
+ if (Class::MOP::IS_RUNNING_ON_5_10()) {
+ return @{ mro::get_linear_isa( (shift)->name ) };
+ }
+ else {
+ my %seen;
+ return grep { !($seen{$_}++) } (shift)->class_precedence_list;
+ }
}
sub class_precedence_list {
my $self = shift;
- # NOTE:
- # We need to check for circular inheritance here.
- # This will do nothing if all is well, and blow
- # up otherwise. Yes, it's an ugly hack, better
- # suggestions are welcome.
- { ($self->name || return)->isa('This is a test for circular inheritance') }
+
+ unless (Class::MOP::IS_RUNNING_ON_5_10()) {
+ # NOTE:
+ # We need to check for circular inheritance here
+ # if we are are not on 5.10, cause 5.8 detects it
+ # late. This will do nothing if all is well, and
+ # blow up otherwise. Yes, it's an ugly hack, better
+ # suggestions are welcome.
+ # - SL
+ ($self->name || return)->isa('This is a test for circular inheritance')
+ }
(
$self->name,
use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.03';
+our $VERSION = '0.04';
our $AUTHORITY = 'cpan:STEVAN';
sub new {