Commit | Line | Data |
0819efc5 |
1 | package TestModule; |
2 | |
3 | use strict; |
4 | require Exporter; |
85a8a980 |
5 | use vars qw(@EXPORT @EXPORT_OK @ISA $IMPORTED); |
0819efc5 |
6 | |
85a8a980 |
7 | @ISA = qw(Exporter); |
8 | @EXPORT = qw(func2); |
9 | @EXPORT_OK = qw(func1); |
0819efc5 |
10 | |
85a8a980 |
11 | ### test if import gets called properly |
26f467e2 |
12 | sub import { $IMPORTED = 1; |
13 | ### this breaks on 5.8.[45] which have a bug with goto's losing |
14 | ### arguments in @_. This is the cause of the 0.14 tester failures |
15 | ### under 5.8.[45]. The bug is NOT in exporter, but core perl: |
16 | ### http://testers.cpan.org/show/Module-Load.html |
17 | #goto &Exporter::import; |
18 | |
19 | ### instead, use the undocumented, but widely used $ExportLevel |
20 | ### which will make sure we pass all arguments, and even works |
21 | ### on buggy 5.8.[45] |
22 | do { local $Exporter::ExportLevel += 1; Exporter::import(@_) } |
23 | } |
24 | |
85a8a980 |
25 | sub imported { $IMPORTED; } |
0819efc5 |
26 | |
85a8a980 |
27 | sub func1 { return "func1"; } |
28 | |
29 | sub func2 { return "func2"; } |
0819efc5 |
30 | |
31 | 1; |