From: Arthur Axel 'fREW' Schmidt Date: Fri, 19 Feb 2010 03:07:15 +0000 (-0600) Subject: add code to die if meta is called X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2149e6c6c5fd7c65b524e0b39511489bd44dff8b;p=gitmo%2FMoose.git add code to die if meta is called --- diff --git a/t/lib/MetaTest.pm b/t/lib/MetaTest.pm index f7a571d..a67f626 100644 --- a/t/lib/MetaTest.pm +++ b/t/lib/MetaTest.pm @@ -1,9 +1,31 @@ package MetaTest; +use strict; +use warnings; + use Exporter 'import'; +use Class::MOP; use Test::More; +use Carp 'confess'; our @EXPORT = qw{skip_meta meta_can_ok skip_all_meta}; +if (skip_meta_condition()) { + my $die_method = sub { confess 'meta should never be called!' }; + for (Class::MOP::get_all_metaclass_instances) { + if ($_->is_immutable) { + my %o = $_->immutable_options; + # the following break since they apparently use ->meta + # How does that even make sense? + + #$_->make_mutable; + #$_->add_method(meta => $die_method); + #$_->make_immutable(%o); + } else { + $_->add_method(meta => $die_method); + } + } +} + sub SKIP_META_MESSAGE() { 'meta-tests disabled'; }