File Coverage

blib/lib/DBIx/Skinny/Mixin/BulkInsertWithTrigger.pm
Criterion Covered Total %
statement 6 13 46.1
branch n/a
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 19 42.1


line stmt bran cond sub pod time code
1             package DBIx::Skinny::Mixin::BulkInsertWithTrigger;
2              
3 1     1   4 use strict;
  1         2  
  1         34  
4 1     1   5 use warnings;
  1         3  
  1         168  
5             our $VERSION = '0.02';
6              
7             sub register_method {
8             +{
9 0     0 0   bulk_insert_with_pre_insert_trigger => \&bulk_insert_with_pre_insert_trigger,
10             };
11             }
12              
13             sub bulk_insert_with_pre_insert_trigger {
14 0     0 0   my ($class, $table, $data, %options) = @_;
15              
16 0           my $schema = $class->schema;
17              
18 0           for my $row ( @{ $data } ) {
  0            
19 0           $class->call_schema_trigger('pre_insert', $schema, $table, $row);
20             }
21 0           $class->bulk_insert($table, $data);
22             # XXX: should call post_insert ? I don't need to fetch inserted data for calling post_insert hook.
23             }
24              
25             1;
26             __END__