File Coverage

blib/lib/DBIx/CSSQuery/DB.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1 4     4   24 use strict;
  4         9  
  4         139  
2 4     4   21 use warnings;
  4         6  
  4         266  
3              
4             package DBIx::CSSQuery::DB;
5              
6             our $VERSION = "0.01";
7              
8 4     4   6755 use self;
  0            
  0            
9              
10             sub new {
11             return bless {}, $self;
12             }
13              
14             sub attr {
15             my ($attr, $value) = args;
16             $self->{$attr} = $value if defined $value;
17             return $self->{$attr};
18             }
19              
20             1;
21              
22             =head1 NAME
23              
24             DBIx::CSSQuery::DB - The database backend layer of DBIx::CSSQuery
25              
26             =head1 SYNOPSIS
27              
28             use DBIx::CSSQuery::DB;
29             my $db = DBIx::CSSQuery::DB->new;
30             $db->attr(dbh => DBI->connect());
31              
32             =head1 INTERFACE
33              
34             =over
35              
36             =item new()
37              
38             Create a new object.
39              
40             =item attr($name [, $value])
41              
42             get/set one object attribute. The only used attribute is "dbh", which should be the return value of
43             C<< DBI->connect >>, Use like
44              
45             $db->attr(dbh => DBI->connect( $dsn, ... ));
46              
47             =back
48              
49             =head1 AUTHOR
50              
51             Kang-min Liu C<< >>
52              
53             =head1 LICENCE AND COPYRIGHT
54              
55             Copyright (c) 2008, 2009, 2010 Kang-min Liu C<< >>.
56              
57             This software is released under the MIT license cited below.
58              
59             =head1 The "MIT" License
60              
61             Permission is hereby granted, free of charge, to any person obtaining
62             a copy of this software and associated documentation files (the
63             "Software"), to deal in the Software without restriction, including
64             without limitation the rights to use, copy, modify, merge, publish,
65             distribute, sublicense, and/or sell copies of the Software, and to
66             permit persons to whom the Software is furnished to do so, subject
67             to the following conditions:
68              
69             The above copyright notice and this permission notice shall be
70             included in all copies or substantial portions of the Software.
71              
72             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
73             EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
74             MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
75             IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
76             ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
77             CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
78             WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
79              
80             =head1 DISCLAIMER OF WARRANTY
81              
82             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
83             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
84             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
85             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
86             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
87             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
88             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
89             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
90             NECESSARY SERVICING, REPAIR, OR CORRECTION.
91              
92             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
93             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
94             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
95             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
96             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
97             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
98             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
99             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
100             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
101             SUCH DAMAGES.
102