[Catalyst-commits] r9034 - in Catalyst-Runtime/5.80/trunk/lib: .
Catalyst
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Wed Jan 7 23:24:56 GMT 2009
Author: t0m
Date: 2009-01-07 23:24:56 +0000 (Wed, 07 Jan 2009)
New Revision: 9034
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
Log:
Use the appropriate MOP function to be a bit neater and more 'correct'
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2009-01-07 23:24:45 UTC (rev 9033)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2009-01-07 23:24:56 UTC (rev 9034)
@@ -7,6 +7,7 @@
use Class::C3::Adopt::NEXT;
use MRO::Compat;
use mro 'c3';
+use Scalar::Util qw/blessed/;
with 'MooseX::Emulate::Class::Accessor::Fast';
with 'Catalyst::ClassData';
@@ -99,7 +100,8 @@
# work in a subclass. If we don't have the package symbol in the
# current class we know we need to copy up to ours, which calling
# the setter will do for us.
- my $meta = $self->Class::MOP::Object::meta();
+ my $class = blessed($self) || $self;
+ my $meta = Class::MOP::get_metaclass_by_name($class);
unless ($meta->has_package_symbol('$_config')) {
$config = $self->merge_config_hashes( $config, {} );
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2009-01-07 23:24:45 UTC (rev 9033)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2009-01-07 23:24:56 UTC (rev 9034)
@@ -4,7 +4,7 @@
with 'MooseX::Emulate::Class::Accessor::Fast';
use Data::Dump;
-use Class::MOP::Object ();
+use Class::MOP ();
our %LEVELS = ();
@@ -15,7 +15,7 @@
{
my @levels = qw[ debug info warn error fatal ];
- my $meta = __PACKAGE__->Class::MOP::Object::meta();
+ my $meta = Class::MOP::get_metaclass_by_name(__PACKAGE__);
for ( my $i = 0 ; $i < @levels ; $i++ ) {
my $name = $levels[$i];
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-01-07 23:24:45 UTC (rev 9033)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-01-07 23:24:56 UTC (rev 9034)
@@ -5,7 +5,6 @@
use Class::C3;
use Moose;
-use Class::MOP::Object ();
extends 'Catalyst::Component';
use bytes;
use Scope::Upper ();
@@ -1033,7 +1032,7 @@
# modifiers work correctly in MyApp (as you have to call setup _before_
# applying modifiers).
Scope::Upper::reap(sub {
- my $meta = $class->Moose::Object::meta();
+ my $meta = Class::MOP::get_metaclass_by_name($class);
$meta->make_immutable unless $meta->is_immutable;
}, 1);
@@ -2102,7 +2101,7 @@
}
if ( $ENV{MOD_PERL} ) {
- my $meta = $class->Class::MOP::Object::meta();
+ my $meta = Class::MOP::get_metaclass_by_name($class);
# create the apache method
$meta->add_method('apache' => sub { shift->engine->apache });
@@ -2252,7 +2251,7 @@
my $env_debug = Catalyst::Utils::env_value( $class, 'DEBUG' );
if ( defined($env_debug) or $levels{debug} ) {
- $class->Class::MOP::Object::meta()->add_method('debug' => sub { 1 });
+ Class::MOP::get_metaclass_by_name($class)->add_method('debug' => sub { 1 });
$class->log->debug('Debug messages enabled');
}
}
@@ -2276,7 +2275,7 @@
my $env = Catalyst::Utils::env_value( $class, 'STATS' );
if ( defined($env) ? $env : ($stats || $class->debug ) ) {
- $class->Class::MOP::Object::meta()->add_method('use_stats' => sub { 1 });
+ Class::MOP::get_metaclass_by_name($class)->add_method('use_stats' => sub { 1 });
$class->log->debug('Statistics enabled');
}
}
@@ -2319,7 +2318,7 @@
$proto->_plugins->{$plugin} = 1;
unless ($instant) {
no strict 'refs';
- if ( my $meta = $class->Class::MOP::Object::meta() ) {
+ if ( my $meta = Class::MOP::get_metaclass_by_name($class) ) {
my @superclasses = ($plugin, $meta->superclasses );
$meta->superclasses(@superclasses);
} else {
More information about the Catalyst-commits
mailing list