my $exporting_package = shift;
my $exporter = shift;
my $exports_from = shift;
- my $export_to_main = shift;
return sub {
strict->import;
warnings->import;
- # we should never export to main
- if ( $CALLER eq 'main' && !$export_to_main ) {
- warn
- qq{$class does not export its sugar to the 'main' package.\n};
- return;
- }
-
my $did_init_meta;
for my $c ( grep { $_->can('init_meta') } $class, @{$exports_from} ) {
# init_meta can apply a role, which when loaded uses
use strict;
use warnings;
-use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 2;
-}
+use Test::More tests => 4;
+use Test::Exception;
-stderr_like( sub { package main; eval 'use Moose' },
- qr/\QMoose does not export its sugar to the 'main' package/,
- 'Moose warns when loaded from the main package' );
+lives_ok {
+ eval 'use Moose';
+} "export to main";
+
+isa_ok( main->meta, "Moose::Meta::Class" );
+
+isa_ok( main->new, "main");
+isa_ok( main->new, "Moose::Object" );
-stderr_like( sub { package main; eval 'use Moose::Role' },
- qr/\QMoose::Role does not export its sugar to the 'main' package/,
- 'Moose::Role warns when loaded from the main package' );