From: gfx Date: Fri, 26 Feb 2010 09:46:26 +0000 (+0900) Subject: Deprecate Mouse->export and Mouse->export_to_level. X-Git-Tag: 0.50_04~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e57a5068a04271a23b54f834ddec60e82b76275e;p=gitmo%2FMouse.git Deprecate Mouse->export and Mouse->export_to_level. Use Mouse->import({into => $package}) and Mouse->import({into_level => $level}) instead. --- diff --git a/lib/Mouse/Exporter.pm b/lib/Mouse/Exporter.pm index e44c256..3cbd81e 100644 --- a/lib/Mouse/Exporter.pm +++ b/lib/Mouse/Exporter.pm @@ -33,10 +33,15 @@ sub setup_import_methods{ export_to_level => sub { my($package, $level, undef, @args) = @_; # the third argument is redundant + + Carp::carp("$package->export_to_level has been deprecated." + ." Use $package->import({ into_level => LEVEL }) instead"); $package->import({ into_level => $level + 1 }, @args); }, export => sub { my($package, $into, @args) = @_; + Carp::carp("$package->export has been deprecated." + ." Use $package->import({ into => PACKAGE }) instead"); $package->import({ into => $into }, @args); }, ); diff --git a/t/990_deprecated/001-export_to_level.t b/t/990_deprecated/001-export_to_level.t index e14ab10..000ab6c 100644 --- a/t/990_deprecated/001-export_to_level.t +++ b/t/990_deprecated/001-export_to_level.t @@ -4,6 +4,8 @@ use warnings; use Test::More tests => 3; BEGIN{ + $SIG{__WARN__} = sub { $_[0] =~ /deprecated/ or warn @_ }; + package Foo; use Mouse;