2 use warnings FATAL => 'all';
3 use Test::More qw(no_plan);
11 our @EXPORT_OK = qw(thing);
15 $INC{"MyExporter.pm"} = 1;
17 package MultiExporter;
23 warnings->import::into($target);
24 MyExporter->import::into($target, 'thing');
25 CheckFile->import::into(1);
29 $INC{"MultiExporter.pm"} = 1;
39 @checkcaller = caller;
42 $checkversion = $_[1];
45 $INC{"CheckFile.pm"} = 1;
52 no warnings FATAL => 'all';
54 #line 1 "import_into_inline.pl"
66 local $SIG{__WARN__} = sub { push @w, @_; };
68 }, 'thing', 'returned thing ok');
70 is(scalar @w, 1, 'Only one entry in @w');
72 like($w[0], qr/uninitialized/, 'Correct warning');
74 is $checkcaller[0], 'TestPackage', 'import by level has correct package';
75 is $checkcaller[1], 'import_into_inline.pl', 'import by level has correct file';
76 is $checkcaller[2], 1, 'import by level has correct line';
78 CheckFile->import::into({
79 package => 'ExplicitPackage',
80 filename => 'explicit-file.pl',
85 is $checkcaller[0], 'ExplicitPackage', 'import with hash has correct package';
86 is $checkcaller[1], 'explicit-file.pl', 'import with hash has correct file';
87 is $checkcaller[2], 42, 'import with hash has correct line';
88 is $checkversion, 219, 'import with hash has correct version';
90 ok( !IPC::Open3->can("open3"), "IPC::Open3 is unloaded" );
91 IPC::Open3->import::into("TestPackage");
92 ok( TestPackage->can("open3"), "IPC::Open3 was use'd and import::into'd" );