Pipeline/Services/DBI.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 27 CC 1 SCAR 6.9
CC
1
Cov
0%
load
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Application::Pipeline::Services::DBI;
2 $VERSION = '0.1.1';
3  
4 #-- pragmas ----------------------------
5 use strict;
6 use warnings;
7  
8 #-- modules ----------------------------
9 use DBI;
10  
11 =head1 Application::Pipeline::Services::DBI
12  
13 This plugin for Application::Pipeline makes available a singleton database
14 handle. To access it from the application:
15  
16 $pipeline->loadPlugin( 'DBI' ( dbi::connect parameters ) );
17  
18 $dbh = $pipeline->dbh;
19  
20 =cut
21  
22 #===============================================================================
23  
24 our $dbh = undef;
25  
26 sub load {
27 my( $class, $pipeline, @args ) = @_;
28 $dbh ||= DBI->connect( @args );
29  
30 $pipeline->addServices( dbh => $dbh );
31 $pipeline->addHandler( 'Teardown', sub{ $dbh->disconnect() }, 'LAST' );
32 return $dbh;
33 }
34  
35 #========
36 1;
37  
38 =head2 Authors
39  
40 Stephen Howard <stephen@thunkit.com>
41  
42 =head2 License
43  
44 This module may be distributed under the same terms as Perl itself.
45  
46 =cut