--- /dev/null
+#!perl\r
+use strict;\r
+use warnings;\r
+use Test::More tests => 14;\r
+\r
+use Mouse ();\r
+\r
+BEGIN{\r
+ package MyMouse;\r
+ use Mouse;\r
+ Mouse::Exporter->setup_import_methods(\r
+ as_is => [qw(foo)],\r
+ also => [qw(Mouse)],\r
+ );\r
+\r
+ sub foo{ 100 }\r
+\r
+ $INC{'MyMouse.pm'}++;\r
+\r
+ package MyMouseEx;\r
+ use Mouse;\r
+ Mouse::Exporter->setup_import_methods(\r
+ as_is => [\&bar],\r
+ also => [qw(MyMouse)],\r
+ );\r
+\r
+ sub bar{ 200 }\r
+\r
+ $INC{'MyMouseEx.pm'}++;\r
+}\r
+\r
+can_ok 'MyMouse', qw(import unimport);\r
+can_ok 'MyMouseEx', qw(import unimport);\r
+\r
+{\r
+ package MyApp;\r
+ use Test::More;\r
+ use MyMouse;\r
+\r
+ can_ok __PACKAGE__, 'meta';\r
+ ok defined(&foo), 'foo is imported';\r
+ ok defined(&has), 'has is also imported';\r
+\r
+ no MyMouse;\r
+\r
+ ok !defined(&foo), 'foo is unimported';\r
+ ok !defined(&has), 'has is also unimported';\r
+}\r
+{\r
+ package MyAppEx;\r
+ use Test::More;\r
+ use MyMouseEx;\r
+\r
+ can_ok __PACKAGE__, 'meta';\r
+ ok defined(&foo), 'foo is imported';\r
+ ok defined(&bar), 'foo is also imported';\r
+ ok defined(&has), 'has is also imported';\r
+\r
+ no MyMouseEx;\r
+\r
+ ok !defined(&foo), 'foo is unimported';\r
+ ok !defined(&bar), 'foo is also unimported';\r
+ ok !defined(&has), 'has is also unimported';\r
+}\r