xref: /openbsd-src/gnu/usr.bin/perl/cpan/Module-Load/t/to_load/TestModule.pm (revision 256a93a44f36679bee503f12e49566c2183f6181)
1b39c5158Smillertpackage TestModule;
2b39c5158Smillert
3b39c5158Smillertuse strict;
4*256a93a4Safresh1use warnings;
5*256a93a4Safresh1
6b39c5158Smillertrequire Exporter;
7b39c5158Smillertuse vars qw(@EXPORT @EXPORT_OK @ISA $IMPORTED);
8b39c5158Smillert
9b39c5158Smillert@ISA        = qw(Exporter);
10b39c5158Smillert@EXPORT     = qw(func2);
11b39c5158Smillert@EXPORT_OK  = qw(func1);
12b39c5158Smillert
13b39c5158Smillert### test if import gets called properly
14b39c5158Smillertsub import   { $IMPORTED = 1;
15b39c5158Smillert               ### this breaks on 5.8.[45] which have a bug with goto's losing
16b39c5158Smillert               ### arguments in @_. This is the cause of the 0.14 tester failures
17b39c5158Smillert               ### under 5.8.[45]. The bug is NOT in exporter, but core perl:
18b39c5158Smillert               ### http://testers.cpan.org/show/Module-Load.html
19b39c5158Smillert               #goto &Exporter::import;
20b39c5158Smillert
21b39c5158Smillert               ### instead, use the undocumented, but widely used $ExportLevel
22b39c5158Smillert               ### which will make sure we pass all arguments, and even works
23b39c5158Smillert               ### on buggy 5.8.[45]
24b39c5158Smillert               do { local $Exporter::ExportLevel += 1; Exporter::import(@_) }
25b39c5158Smillert             }
26b39c5158Smillert
27b39c5158Smillertsub imported { $IMPORTED;       }
28b39c5158Smillert
29b39c5158Smillertsub func1    { return "func1";  }
30b39c5158Smillert
31b39c5158Smillertsub func2    { return "func2";  }
32b39c5158Smillert
33b39c5158Smillert1;
34