2 use warnings FATAL => 'all';
3 use Test::More qw(no_plan);
7 $INC{"MyExporter.pm"} = __FILE__;
11 our @EXPORT_OK = qw(thing);
20 $INC{"CheckFile.pm"} = __FILE__;
23 @importcaller = caller;
31 package MultiExporter;
32 $INC{"MultiExporter.pm"} = __FILE__;
38 warnings->import::into($target);
39 MyExporter->import::into($target, 'thing');
40 CheckFile->import::into(1);
47 no warnings FATAL => 'all';
49 #line 1 "import_into_inline.pl"
61 local $SIG{__WARN__} = sub { push @w, @_; };
63 }, 'thing', 'returned thing ok');
65 is(scalar @w, 1, 'Only one entry in @w');
67 like($w[0], qr/uninitialized/, 'Correct warning');
69 is $importcaller[0], 'TestPackage',
70 'import by level has correct package';
71 is $importcaller[1], 'import_into_inline.pl',
72 'import by level has correct file';
73 is $importcaller[2], 1,
74 'import by level has correct line';
78 CheckFile->import::into({
79 package => 'ExplicitPackage',
80 filename => 'explicit-file.pl',
85 is $importcaller[0], 'ExplicitPackage',
86 'import with hash has correct package';
87 is $importcaller[1], 'explicit-file.pl',
88 'import with hash has correct file';
89 is $importcaller[2], 42,
90 'import with hash has correct line';
92 'import with hash has correct version';
95 package LevelExporter;
96 $INC{'LevelExporter.pm'} = __FILE__;
99 CheckFile->import::into({
106 ok( !IPC::Open3->can("open3"), "IPC::Open3 is unloaded" );
107 IPC::Open3->import::into("TestPackage");
108 ok( TestPackage->can("open3"), "IPC::Open3 was use'd and import::into'd" );