File Coverage

blib/lib/OpenERP/OOM/Link/Provider.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 6 83.3


line stmt bran cond sub pod time code
1             package OpenERP::OOM::Link::Provider;
2              
3 2     2   1691 use Moose::Role;
  2         4  
  2         15  
4              
5             requires 'provide_link';
6             with 'OpenERP::OOM::DynamicUtils';
7              
8             sub close_connections
9       0 1   {
10             }
11              
12             =head1 NAME
13              
14             OpenERP::OOM::Link::Provider
15              
16             =head1 DESCRIPTION
17              
18             This is the role for a link provider that provides a way to link another dataset,
19             normally a DBIC dataset.
20              
21             =head1 SYNOPSIS
22              
23             package MyLinkProvider;
24              
25             use Moose;
26             with 'OpenERP::OOM::Link::Provider';
27              
28             sub provide_link
29             {
30             my ($self, $class) = @_;
31            
32             my $package = ($class =~ /^\+/) ? $class : "OpenERP::OOM::Link::$class";
33              
34             eval "use $package";
35             $self->ensure_class_loaded($package);
36            
37             return $package->new(
38             schema => $self,
39             config => $self->link_config->{$class},
40             );
41             }
42              
43             1;
44              
45             =head1 METHODS
46              
47             =head2 close_connections
48              
49             This method should close any open database connections held by the link provider.
50              
51             =head1 COPYRIGHT and LICENSE
52              
53             Copyright (C) 2011 OpusVL
54              
55             This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
56              
57             =cut
58              
59             1;