File: Safe.pm

package info (click to toggle)
debbugs 2.6.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,800 kB
  • sloc: perl: 19,270; makefile: 81; sh: 75
file content (31 lines) | stat: -rw-r--r-- 510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# this is a tiny module which basically provides a fake safe for use with Devel::Cover
package Safe;

sub new {
    my $class = shift;
    my $self = {root => 'fakeSafe'};
    bless ($self,$class);
    return $self;
}

sub permit {
}

sub reval {
    my ($self,$code) = @_;
    eval "package $self->{root}; $code";
}

sub root {
    my ($self) = @_;
    return($self->{root});
}

sub varglob {
    my ($self,$var) = @_;
    no strict 'refs';
    no warnings 'once';
    return *{$self->{root}."::$var"};
}

1;