World/Hole.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 49 CC 5 SCAR 23.0
CC
5
Cov
0%
call_09_fix
20.0
call
6.0
DESTROY
2.0
CRAP 10.0
1 #############################################################################
2 ## Name: Hole.pm
3 ## Purpose: Safe::World::Hole - Front end for Safe::Hole
4 ## Author: Graciliano M. P.
5 ## Modified by:
6 ## Created: 23/01/2004
7 ## RCS-ID:
8 ## Copyright: (c) 2004 Graciliano M. P.
9 ## Licence: This program is free software; you can redistribute it and/or
10 ## modify it under the same terms as Perl itself
11 #############################################################################
12
13 package Safe::World::Hole ;
14
15 use vars qw($VERSION @ISA) ;
16 $VERSION = '0.09';
17
18 @ISA = qw(Safe::Hole) ;
19
20 no warnings ;
21
22 ###########
23 # REQUIRE #
24 ###########
25
26 use Safe::Hole ;
27
28 ##########
29 # SCOPES #
30 ##########
31
32 my $Safe_Hole_call = \&Safe::Hole::call ;
33
34 ########
35 # CALL #
36 ########
37
38 sub call {
39 my $this = shift ;
40 if ( $Safe::Hole::VERSION == 0.09 ) { return $this->call_09_fix(@_) ;}
41 else {
42 &$Safe_Hole_call($this , @_) ; ## Can't use $this->SUPER::call(), since we won't find Safe::Hole::call in the scope!
43 }
44 }
45
46 ###############
47 # CALL_09_FIX #
48 ###############
49
50 sub call_09_fix {
51 my $this = shift ;
52 my $coderef = shift ;
53 my @args = @_ ;
54
55 my (@r,$did_not_die) ;
56 my $wantarray = wantarray ;
57
58 package Safe::Hole::User ;
59
60 my $inner_call = sub {
61 eval {
62 @_ = @args;
63 if ( $wantarray ) { @r = &$coderef ;}
64 else { @r = scalar &$coderef ;}
65 $did_not_die = 1 ;
66 }
67 };
68
69 Safe::Hole::_hole_call_sv($this->{STASH},undef, $inner_call) ;
70
71 die $@ unless $did_not_die ;
72 return $wantarray ? @r : $r[0] ;
73 }
74
75 sub DESTROY {}
76
77 #######
78 # END #
79 #######
80
81 1;
82
83 __END__