File Coverage

blib/lib/DBIx/Simple/Interpol.pm
Criterion Covered Total %
statement 24 24 100.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 32 33 96.9


line stmt bran cond sub pod time code
1 1     1   782 use 5.006;
  1         4  
  1         50  
2 1     1   7 use strict;
  1         1  
  1         52  
3 1     1   7 no warnings;
  1         3  
  1         90  
4              
5             package DBIx::Simple::Interpol;
6             $DBIx::Simple::Interpol::VERSION = '1.005';
7             # ABSTRACT: monkey-patch DBIx::Simple to use SQL::Interpol
8              
9 1         15 use Exporter::Tidy _map => {
10             sql_interp => \&SQL::Interpol::sql_interp,
11             sql => \&SQL::Interpol::sql,
12 1     1   1347 };
  1         14  
13              
14             BEGIN {
15 1     1   748 require SQL::Interpol;
16 1         4803 require DBIx::Simple;
17 1 50       25 die 'Cannot find method to patch' if not DBIx::Simple->can( 'iquery' );
18             *DBIx::Simple::iquery = sub {
19 1     1   119 use warnings; # limited scope to avoid "Subroutine redefined"
  1         3  
  1         94  
20 1     1   1681 my $self = shift;
21 1         12 my $p = SQL::Interpol::Parser->new;
22 1         27 my $sql = $p->parse( @_ );
23 1         194 return $self->query( $sql, @{ $p->bind } );
  1         30  
24 1         41 };
25             }
26              
27             1;
28              
29             __END__