File Coverage

blib/lib/Class/DBI/Plugin/NoCache.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod n/a
total 12 28 42.8


line stmt bran cond sub pod time code
1             package Class::DBI::Plugin::NoCache;
2 1     1   797 use strict;
  1         2  
  1         34  
3 1     1   5 use vars qw/$VERSION/;
  1         1  
  1         95  
4             $VERSION = 0.03;
5             sub import {
6 0     0     my $class = shift;
7 0           my $pkg = caller(0);
8 0 0         unless($pkg->isa('Class::DBI')){
9 0           require Carp;
10 0           Carp::croak("This is a plugin for Class::DBI.");
11             }
12 0           $pkg->mk_classdata('nocache');
13 1     1   20 no strict 'refs';
  1         2  
  1         124  
14 0           my $super = $pkg->can('_init');
15 0           *{$pkg."::_init"} = sub {
16 0     0     my $caller = shift;
17 0           local $Class::DBI::Weaken_Is_Available = not $caller->nocache;
18 0           return $super->($caller, @_);
19 0           };
20             }
21             1;
22             __END__