[Catalyst-commits] r9315 - in Catalyst-Runtime/5.80/trunk:
lib/Catalyst/Engine/HTTP lib/Catalyst/Engine/HTTP/Restarter
t/lib/TestApp/Controller/Immutable
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Feb 15 11:02:56 GMT 2009
Author: t0m
Date: 2009-02-15 11:02:56 +0000 (Sun, 15 Feb 2009)
New Revision: 9315
Modified:
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Immutable/HardToReload.pm
Log:
Don't barf by trying to make roles mutable.
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2009-02-15 10:11:34 UTC (rev 9314)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2009-02-15 11:02:56 UTC (rev 9315)
@@ -141,8 +141,10 @@
$id = B::Hooks::OP::Check::StashChange::register(sub {
my ($new, $old) = @_;
my $meta = find_meta($new);
- if ($meta) {
- $meta->make_mutable if $meta->is_immutable;
+ if ($meta) { # A little paranoia here - Moose::Meta::Role has neither of these methods.
+ my $is_immutable = $meta->can('is_immutable');
+ my $make_mutable = $meta->can('make_mutable');
+ $meta->$make_mutable() if $is_immutable && $make_mutable && $meta->$is_immutable();
}
});
}
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm 2009-02-15 10:11:34 UTC (rev 9314)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm 2009-02-15 11:02:56 UTC (rev 9315)
@@ -86,6 +86,7 @@
my @metas = map { find_meta($_) } ($class, map { blessed($_) } values %{ $class->components });
foreach my $meta (@metas) {
+ # Paranoia unneeded, all component metaclasses should have immutable
$meta->make_mutable if $meta->is_immutable;
}
}
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Immutable/HardToReload.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Immutable/HardToReload.pm 2009-02-15 10:11:34 UTC (rev 9314)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Immutable/HardToReload.pm 2009-02-15 11:02:56 UTC (rev 9315)
@@ -1,3 +1,7 @@
+package TestApp::Controller::Immutable::HardToReload::Role;
+use Moose::Role; # Role metaclass does not have make_immutable..
+no Moose::Role;
+
package TestApp::Controller::Immutable::HardToReload;
use Moose;
BEGIN { extends 'Catalyst::Controller' }
More information about the Catalyst-commits
mailing list