From: Stevan Little Date: Sun, 16 Mar 2008 21:13:53 +0000 (+0000) Subject: s/make_immutable/metaclass->make_immutable/ X-Git-Tag: 0_55~272 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f02c03d6b01452536d3e3b189438d73cf16568a2;p=gitmo%2FMoose.git s/make_immutable/metaclass->make_immutable/ --- diff --git a/benchmarks/caf_vs_moose.pl b/benchmarks/caf_vs_moose.pl index 3583bc1..d9c8d8b 100644 --- a/benchmarks/caf_vs_moose.pl +++ b/benchmarks/caf_vs_moose.pl @@ -11,13 +11,13 @@ package MooseImmutable; use Moose; has foo => (is => 'rw'); - make_immutable(); + metaclass->make_immutable(); } { package MooseImmutable::NoConstructor; use Moose; has foo => (is => 'rw'); - make_immutable(inline_constructor => 0); + metaclass->make_immutable(inline_constructor => 0); } { package ClassAccessorFast; diff --git a/lib/Moose.pm b/lib/Moose.pm index 09a9603..3c61cfd 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -174,6 +174,7 @@ use Moose::Util (); make_immutable => sub { my $class = $CALLER; return subname 'Moose::make_immutable' => sub { + warn "Use of make_immutable() is deprecated, please use metaclass->make_immutable now\n"; $class->meta->make_immutable(@_); }; }, diff --git a/t/000_recipes/001_recipe.t b/t/000_recipes/001_recipe.t index bdc56ef..3b5651a 100644 --- a/t/000_recipes/001_recipe.t +++ b/t/000_recipes/001_recipe.t @@ -23,7 +23,7 @@ BEGIN { $self->y(0); } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package Point3D; use Moose; @@ -37,7 +37,7 @@ BEGIN { $self->{z} = 0; }; - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $point = Point->new(x => 1, y => 2); diff --git a/t/000_recipes/002_recipe.t b/t/000_recipes/002_recipe.t index cff422b..f07bb06 100644 --- a/t/000_recipes/002_recipe.t +++ b/t/000_recipes/002_recipe.t @@ -29,7 +29,7 @@ BEGIN { $self->balance($current_balance - $amount); } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package CheckingAccount; use Moose; @@ -47,7 +47,7 @@ BEGIN { } }; - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $savings_account = BankAccount->new(balance => 250); diff --git a/t/000_recipes/003_recipe.t b/t/000_recipes/003_recipe.t index 0e680d4..804e007 100644 --- a/t/000_recipes/003_recipe.t +++ b/t/000_recipes/003_recipe.t @@ -46,7 +46,7 @@ BEGIN { $tree->parent($self) if defined $tree; }; - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $root = BinaryTree->new(node => 'root'); diff --git a/t/000_recipes/004_recipe.t b/t/000_recipes/004_recipe.t index d7ddd98..b5a9af2 100644 --- a/t/000_recipes/004_recipe.t +++ b/t/000_recipes/004_recipe.t @@ -45,7 +45,7 @@ BEGIN { has 'state' => (is => 'rw', isa => 'USState'); has 'zip_code' => (is => 'rw', isa => 'USZipCode'); - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package Company; @@ -80,7 +80,7 @@ BEGIN { } }; - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package Person; @@ -98,7 +98,7 @@ BEGIN { $self->last_name; } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package Employee; @@ -114,7 +114,7 @@ BEGIN { super() . ', ' . $self->title }; - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $ii; diff --git a/t/000_recipes/005_recipe.t b/t/000_recipes/005_recipe.t index f44acc8..2189c99 100644 --- a/t/000_recipes/005_recipe.t +++ b/t/000_recipes/005_recipe.t @@ -62,7 +62,7 @@ BEGIN { default => sub { HTTP::Headers->new } ); - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $r = Request->new; diff --git a/t/000_recipes/006_recipe.t b/t/000_recipes/006_recipe.t index 0c1b8c9..d792ba7 100644 --- a/t/000_recipes/006_recipe.t +++ b/t/000_recipes/006_recipe.t @@ -81,7 +81,7 @@ BEGIN { sprintf '$%0.2f USD' => $self->amount } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } ok(US::Currency->does('Comparable'), '... US::Currency does Comparable'); diff --git a/t/010_basics/015_metaclass_keyword.t b/t/010_basics/015_metaclass_keyword.t index 85eefa5..3c07d34 100644 --- a/t/010_basics/015_metaclass_keyword.t +++ b/t/010_basics/015_metaclass_keyword.t @@ -1,12 +1,19 @@ #!/usr/bin/perl +use strict; +use warnings; + +use Test::More tests => 2; + +BEGIN { + use_ok('Moose'); +} + { package Foo; - use Test::More tests => 1; use Moose; - is( metaclass(), __PACKAGE__->meta, - 'metaclass and __PACKAGE__->meta are the same' ); + ::is( metaclass(), __PACKAGE__->meta, 'metaclass and __PACKAGE__->meta are the same' ); } diff --git a/t/020_attributes/019_attribute_lazy_initializer.t b/t/020_attributes/019_attribute_lazy_initializer.t index 6f89493..88d755f 100644 --- a/t/020_attributes/019_attribute_lazy_initializer.t +++ b/t/020_attributes/019_attribute_lazy_initializer.t @@ -115,7 +115,7 @@ BEGIN { }, ); - make_immutable; + metaclass->make_immutable; } { @@ -143,7 +143,7 @@ BEGIN { }, ); - make_immutable; + metaclass->make_immutable; } dies_ok { diff --git a/t/030_roles/003_apply_role.t b/t/030_roles/003_apply_role.t index f2adea8..96f406a 100644 --- a/t/030_roles/003_apply_role.t +++ b/t/030_roles/003_apply_role.t @@ -39,7 +39,7 @@ BEGIN { sub boo { 'BarClass::boo' } sub foo { 'BarClass::foo' } # << the role overrides this ... - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package FooClass; @@ -52,7 +52,7 @@ BEGIN { sub goo { 'FooClass::goo' } # << overrides the one from the role ... - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); }{ package FooBarClass; diff --git a/t/060_compat/003_foreign_inheritence.t b/t/060_compat/003_foreign_inheritence.t index 2ee2b37..573cc22 100644 --- a/t/060_compat/003_foreign_inheritence.t +++ b/t/060_compat/003_foreign_inheritence.t @@ -35,7 +35,7 @@ BEGIN { return $class->meta->new_object('__INSTANCE__' => $super, @_); } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); package Bucket; use metaclass 'Class::MOP::Class'; diff --git a/t/300_immutable/002_apply_roles_to_immutable.t b/t/300_immutable/002_apply_roles_to_immutable.t index cb86ed0..6149a1d 100644 --- a/t/300_immutable/002_apply_roles_to_immutable.t +++ b/t/300_immutable/002_apply_roles_to_immutable.t @@ -26,7 +26,7 @@ BEGIN { sub baz { 'Foo::baz' } - make_immutable(debug => 0); + metaclass->make_immutable(debug => 0); } my $foo = Foo->new; diff --git a/t/300_immutable/006_immutable_nonmoose_subclass.t b/t/300_immutable/006_immutable_nonmoose_subclass.t index 29143f3..200db87 100644 --- a/t/300_immutable/006_immutable_nonmoose_subclass.t +++ b/t/300_immutable/006_immutable_nonmoose_subclass.t @@ -82,7 +82,7 @@ Sorry Sartak. sub child { 1 } - make_immutable; + metaclass->make_immutable; } is(blessed(Grandparent->new), "Grandparent", "got a Grandparent object out of Grandparent->new");