]> git.donarmstrong.com Git - debbugs.git/blob - t/cover_lib/Safe.pm
add testcover rule; add fake safe for testing coverage
[debbugs.git] / t / cover_lib / Safe.pm
1 # this is a tiny module which basically provides a fake safe for use with Devel::Cover
2 package Safe;
3
4 sub new {
5     my $class = shift;
6     my $self = {root => 'fakeSafe'};
7     bless ($self,$class);
8     return $self;
9 }
10
11 sub permit {
12 }
13
14 sub reval {
15     my ($self,$code) = @_;
16     eval "package $self->{root}; $code";
17 }
18
19 sub root {
20     my ($self) = @_;
21     return($self->{root});
22 }
23
24 sub varglob {
25     my ($self,$var) = @_;
26     no strict 'refs';
27     no warnings 'once';
28     return *{$self->{root}."::$var"};
29 }
30
31 1;