File Coverage

blib/lib/Rubric/DBI.pm
Criterion Covered Total %
statement 18 21 85.7
branch n/a
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 25 29 86.2


line stmt bran cond sub pod time code
1 12     12   2933 use strict;
  12         18  
  12         251  
2 12     12   44 use warnings;
  12         20  
  12         357  
3             # ABSTRACT: Rubric's subclass of Class::DBI
4              
5             #pod =head1 DESCRIPTION
6             #pod
7             #pod Rubric::DBI subclasses Class::DBI. It sets the connection by using the DSN
8             #pod retrieved from Rubric::Config.
9             #pod
10             #pod =cut
11              
12             use Rubric::Config;
13 12     12   49 use Class::DBI 0.96;
  12         20  
  12         51  
14 12     12   6853 use base qw(Class::DBI);
  12         469203  
  12         81  
15 12     12   410  
  12         20  
  12         831  
16             use Class::DBI::AbstractSearch;
17 12     12   3889  
  12         272236  
  12         1432  
18             DBI->trace(Rubric::Config->dbi_trace_level, Rubric::Config->dbi_trace_file);
19              
20             my $dsn = Rubric::Config->dsn;
21             my $db_user = Rubric::Config->db_user;
22             my $db_pass = Rubric::Config->db_pass;
23              
24             __PACKAGE__->connection(
25             $dsn,
26             $db_user,
27             $db_pass,
28             { AutoCommit => 1 }
29             );
30              
31             #pod =head1 METHODS
32             #pod
33             #pod =head2 vacuum
34             #pod
35             #pod This method performs periodic maintenance, cleaning up records that are no
36             #pod longer needed.
37             #pod
38             #pod =cut
39              
40             my $self = shift;
41             my $dbh = $self->db_Main;
42 0     0 1   my $pruned_links = $dbh->do(
43 0           "DELETE FROM links WHERE id NOT IN ( SELECT link FROM entries )"
44 0           );
45             }
46              
47             1;
48              
49              
50             =pod
51              
52             =encoding UTF-8
53              
54             =head1 NAME
55              
56             Rubric::DBI - Rubric's subclass of Class::DBI
57              
58             =head1 VERSION
59              
60             version 0.157
61              
62             =head1 DESCRIPTION
63              
64             Rubric::DBI subclasses Class::DBI. It sets the connection by using the DSN
65             retrieved from Rubric::Config.
66              
67             =head1 PERL VERSION
68              
69             This code is effectively abandonware. Although releases will sometimes be made
70             to update contact info or to fix packaging flaws, bug reports will mostly be
71             ignored. Feature requests are even more likely to be ignored. (If someone
72             takes up maintenance of this code, they will presumably remove this notice.)
73             This means that whatever version of perl is currently required is unlikely to
74             change -- but also that it might change at any new maintainer's whim.
75              
76             =head1 METHODS
77              
78             =head2 vacuum
79              
80             This method performs periodic maintenance, cleaning up records that are no
81             longer needed.
82              
83             =head1 AUTHOR
84              
85             Ricardo SIGNES <rjbs@semiotic.systems>
86              
87             =head1 COPYRIGHT AND LICENSE
88              
89             This software is copyright (c) 2004 by Ricardo SIGNES.
90              
91             This is free software; you can redistribute it and/or modify it under
92             the same terms as the Perl 5 programming language system itself.
93              
94             =cut