File Coverage

blib/lib/Safe/World/Hole.pm
Criterion Covered Total %
statement 9 29 31.0
branch 0 8 0.0
condition n/a
subroutine 3 7 42.8
pod 1 2 50.0
total 13 46 28.2


line stmt bran cond sub pod time code
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 1     1   5 use vars qw($VERSION @ISA) ;
  1         1  
  1         83  
16             $VERSION = '0.09';
17            
18             @ISA = qw(Safe::Hole) ;
19            
20 1     1   6 no warnings ;
  1         1  
  1         51  
21            
22             ###########
23             # REQUIRE #
24             ###########
25            
26 1     1   806 use Safe::Hole ;
  1         1906  
  1         277  
27            
28             ##########
29             # SCOPES #
30             ##########
31            
32             my $Safe_Hole_call = \&Safe::Hole::call ;
33            
34             ########
35             # CALL #
36             ########
37            
38             sub call {
39 0     0 1   my $this = shift ;
40 0 0         if ( $Safe::Hole::VERSION == 0.09 ) { return $this->call_09_fix(@_) ;}
  0            
41             else {
42 0           &$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 0     0 0   my $this = shift ;
52 0           my $coderef = shift ;
53 0           my @args = @_ ;
54            
55 0           my (@r,$did_not_die) ;
56 0           my $wantarray = wantarray ;
57            
58             package Safe::Hole::User ;
59            
60             my $inner_call = sub {
61 0     0     eval {
62 0           @_ = @args;
63 0 0         if ( $wantarray ) { @r = &$coderef ;}
  0            
64 0           else { @r = scalar &$coderef ;}
65 0           $did_not_die = 1 ;
66             }
67 0           };
68            
69 0           Safe::Hole::_hole_call_sv($this->{STASH},undef, $inner_call) ;
70            
71 0 0         die $@ unless $did_not_die ;
72 0 0         return $wantarray ? @r : $r[0] ;
73             }
74            
75 0     0     sub DESTROY {}
76            
77             #######
78             # END #
79             #######
80            
81             1;
82            
83             __END__