use Class::MOP::Immutable;
BEGIN {
- our $VERSION = '0.49';
+ our $VERSION = '0.53';
our $AUTHORITY = 'cpan:STEVAN';
use XSLoader;
XSLoader::load( 'Class::MOP', $VERSION );
unless ($] < 5.009_005) {
- no warnings 'redefine';
+ 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;
}
# rather than re-produce it here
'namespace' => \&Class::MOP::Package::namespace
},
- # NOTE:
- # protect this from silliness
- init_arg => '!............( DO NOT DO THIS )............!',
+ init_arg => undef,
default => sub { \undef }
))
);
# rather than re-produce it here
'version' => \&Class::MOP::Module::version
},
- # NOTE:
- # protect this from silliness
- init_arg => '!............( DO NOT DO THIS )............!',
+ init_arg => undef,
default => sub { \undef }
))
);
# rather than re-produce it here
'authority' => \&Class::MOP::Module::authority
},
- # NOTE:
- # protect this from silliness
- init_arg => '!............( DO NOT DO THIS )............!',
+ init_arg => undef,
default => sub { \undef }
))
);
# rather than re-produce it here
'superclasses' => \&Class::MOP::Class::superclasses
},
- # NOTE:
- # protect this from silliness
- init_arg => '!............( DO NOT DO THIS )............!',
+ init_arg => undef,
default => sub { \undef }
))
);
);
Class::MOP::Attribute->meta->add_attribute(
+ Class::MOP::Attribute->new('$!initializer' => (
+ init_arg => 'initializer',
+ reader => { 'initializer' => \&Class::MOP::Attribute::initializer },
+ predicate => { 'has_initializer' => \&Class::MOP::Attribute::has_initializer },
+ ))
+);
+
+Class::MOP::Attribute->meta->add_attribute(
Class::MOP::Attribute->new('$!writer' => (
init_arg => 'writer',
reader => { 'writer' => \&Class::MOP::Attribute::writer },
=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
Yuval (nothingmuch) Kogman
+Scott (konobi) McWhirter
+
=head1 COPYRIGHT AND LICENSE
-Copyright 2006, 2007 by Infinity Interactive, Inc.
+Copyright 2006-2008 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>