Commit | Line | Data |
0395308e |
1 | package Devel::BeginLift; |
2 | |
3 | use strict; |
4 | use warnings; |
1594b447 |
5 | use 5.008001; |
0395308e |
6 | |
1594b447 |
7 | our $VERSION = 0.01; |
0395308e |
8 | |
1594b447 |
9 | use vars qw(%lift); |
10 | use base qw(DynaLoader); |
0395308e |
11 | |
1594b447 |
12 | bootstrap Devel::BeginLift; |
0395308e |
13 | |
14 | sub import { |
15 | my ($class, @args) = @_; |
16 | my $target = caller; |
17 | $class->setup_for($target => \@args); |
18 | } |
19 | |
20 | sub unimport { |
21 | my ($class) = @_; |
22 | my $target = caller; |
23 | $class->teardown_for($target); |
24 | } |
25 | |
26 | sub setup_for { |
27 | my ($class, $target, $args) = @_; |
28 | setup(); |
29 | $lift{$target}{$_} = 1 for @$args; |
30 | } |
31 | |
32 | sub teardown_for { |
33 | my ($class, $target) = @_; |
34 | delete $lift{$target}; |
35 | teardown(); |
36 | } |
37 | |
38 | 1; |