Commit | Line | Data |
d9268716 |
1 | #!./perl |
2 | use vars qw(@funcs $i); |
3 | |
4 | BEGIN { |
5 | # Functions exported by FileCache; |
6 | @funcs = qw[cacheout cacheout_close]; |
7 | $i = 0; |
8 | } |
9 | |
10 | use Test::More tests => 8; |
11 | |
12 | # Test 6: Test that exporting both works to package main and |
13 | # other packages. Now using Exporter. |
14 | |
15 | # First, we shouldn't be able to have these in our namespace |
16 | # Add them to BEGIN so the later 'use' doesn't influence this |
17 | # test |
18 | BEGIN { |
19 | ok(not __PACKAGE__->can($_)) foreach @funcs; |
20 | } |
21 | |
22 | # With an empty import list, we also shouldn't have them in |
23 | # our namespace. |
24 | # Add them to BEGIN so the later 'use' doesn't influence this |
25 | # test |
26 | BEGIN { |
27 | use FileCache (); |
28 | ok(not __PACKAGE__->can($_)) foreach @funcs; |
29 | } |
30 | |
31 | |
32 | # Now, we use FileCache in 'main' |
33 | { |
34 | use FileCache; |
35 | ok(__PACKAGE__->can($_)) foreach @funcs; |
36 | } |
37 | |
38 | # Now we use them in another package |
39 | { |
40 | package X; |
41 | use FileCache; |
42 | ::ok(__PACKAGE__->can($_)) foreach @main::funcs; |
43 | } |
44 | |