],
);
+our $CALLED_VIA_EXPORT_HACK;
sub init_meta {
shift;
my %args = @_;
+ Moose::Deprecated::deprecated(
+ 'Calling Moose->init_meta directly has been deprecated.'
+ . ' Use Moose::Exporter and let it call init_meta for you' )
+ unless $CALLED_VIA_EXPORT_HACK;
+
my $class = $args{for_class}
or Moose->throw_error("Cannot call init_meta without specifying a for_class");
my $base_class = $args{base_class} || 'Moose::Object';
use warnings;
use Package::DeprecationManager 0.07 -deprecations => {
+ 'calling Moose->init_meta directly' => '2.0200',
'optimized type constraint sub ref' => '2.0000',
'default is for Native Trait' => '1.14',
'default default for Native Trait' => '1.14',
strict->import;
warnings->import;
+ local $Moose::CALLED_VIA_EXPORT_HACK = 1;
+
my $did_init_meta;
for my $c ( grep { $_->can('init_meta') } $class, @{$exports_from} ) {
);
}
+{
+ package Pack4;
+
+}
+
+stderr_like {
+ Moose->init_meta( for_class => __PACKAGE__ );
+}
+qr/\QCalling Moose->init_meta directly has been deprecated/,
+ 'deprecation warning when calling init_meta directly';
+
+
done_testing;