File Coverage

blib/lib/Schema/Data/Plugin.pm
Criterion Covered Total %
statement 15 31 48.3
branch 0 6 0.0
condition 0 6 0.0
subroutine 5 8 62.5
pod 0 3 0.0
total 20 54 37.0


line stmt bran cond sub pod time code
1             package Schema::Data::Plugin;
2              
3 2     2   75243 use strict;
  2         20  
  2         58  
4 2     2   11 use warnings;
  2         4  
  2         57  
5              
6 2     2   949 use Class::Utils qw(set_params);
  2         59465  
  2         45  
7 2     2   166 use Error::Pure qw(err);
  2         5  
  2         84  
8 2     2   13 use Scalar::Util qw(blessed);
  2         4  
  2         611  
9              
10             our $VERSION = 0.05;
11              
12             sub new {
13 0     0 0   my ($class, @params) = @_;
14              
15             # Create object.
16 0           my $self = bless {}, $class;
17              
18             # Schema.
19 0           $self->{'schema'} = undef;
20              
21             # Verbose callback.
22 0           $self->{'verbose_cb'} = undef;
23              
24             # Process parameters.
25 0           set_params($self, @params);
26              
27 0 0         if (! defined $self->{'schema'}) {
28 0           err "Parameter 'schema' is required.";
29             }
30 0 0 0       if (! blessed($self->{'schema'}) || ! $self->{'schema'}->isa('DBIx::Class::Schema')) {
31 0           err "Parameter 'schema' must be a instance of 'DBIx::Class::Schema'.";
32             }
33              
34 0 0 0       if (defined $self->{'verbose_cb'} && ref $self->{'verbose_cb'} ne 'CODE') {
35 0           err "Parameter 'verbose_cb' must be reference to code.";
36             }
37              
38 0           return $self;
39             }
40              
41             sub load {
42 0     0 0   my $self = shift;
43              
44 0           err 'Package __PACKAGE__ is abstract class. load() method must be '.
45             'defined in inherited class.';
46             }
47              
48             sub supported_versions {
49 0     0 0   my $self = shift;
50              
51 0           err 'Package __PACKAGE__ is abstract class. supported_versions() method must be '.
52             'defined in inherited class.';
53             }
54              
55             1;
56              
57             __END__