File Coverage

blib/lib/ResourcePool/Resource.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition 1 3 33.3
subroutine 9 9 100.0
pod 5 6 83.3
total 36 39 92.3


line stmt bran cond sub pod time code
1             #*********************************************************************
2             #*** ResourcePool::Resource
3             #*** Copyright (c) 2002,2003 by Markus Winand
4             #*** $Id: Resource.pm,v 1.32 2013-04-16 10:14:44 mws Exp $
5             #*********************************************************************
6              
7             package ResourcePool::Resource;
8              
9 7     7   915 use strict;
  7         11  
  7         260  
10 7     7   35 use vars qw($VERSION);
  7         14  
  7         2056  
11              
12             $VERSION = "1.0107";
13              
14             sub new($@) {
15 50     50 0 88 my $proto = shift;
16 50   33     182 my $class = ref($proto) || $proto;
17 50         125 my $self = {};
18 50         125 $self->{PR} = $self;
19 50         93 $self->{ARGUMENT} = shift;
20 50         208 $self->{VALID} = 1;
21              
22 50         110 bless($self, $class);
23              
24 50         155 return $self;
25             }
26              
27             sub close($) {
28 2     2 1 7 return undef;
29             }
30              
31             sub fail_close($) {
32 26     26 1 100 warn "ResourcePool::Resource: closing failed Resource\n";
33 26         90 return undef;
34             }
35              
36             sub precheck($) {
37 234     234 1 1014 return $_[0]->{VALID};
38             }
39              
40             sub postcheck($) {
41 196     196 1 894 return $_[0]->{VALID};
42             }
43              
44             sub get_plain_resource($) {
45 228     228 1 633 return $_[0]->{PR};
46             }
47              
48             ### ### Private part starts here
49              
50             sub _my_very_private_and_secret_test_hook($$) {
51 5     5   1505 $_[0]->{VALID} = $_[1];
52             }
53              
54             1;