File Coverage

blib/lib/Rose/DB/Object/Metadata/Column/Boolean.pm
Criterion Covered Total %
statement 12 21 57.1
branch 1 4 25.0
condition 2 9 22.2
subroutine 5 9 55.5
pod 4 6 66.6
total 24 49 48.9


line stmt bran cond sub pod time code
1             package Rose::DB::Object::Metadata::Column::Boolean;
2              
3 2     2   15 use strict;
  2         4  
  2         66  
4              
5 2     2   13 use Rose::DB::Object::Metadata::Column::Scalar;
  2         4  
  2         351  
6             our @ISA = qw(Rose::DB::Object::Metadata::Column::Scalar);
7              
8             our $VERSION = '0.788';
9              
10             foreach my $type (__PACKAGE__->available_method_types)
11             {
12             __PACKAGE__->method_maker_type($type => 'boolean')
13             }
14              
15 13     13 1 65 sub type { 'boolean' }
16              
17 0     0 1 0 sub parse_value { shift; shift->parse_boolean(@_) }
  0         0  
18 0     0 1 0 sub format_value { shift; shift->format_boolean(@_) }
  0         0  
19              
20             sub should_inline_value
21             {
22 0     0 1 0 my($self, $db, $value) = @_;
23 2     2   23 no warnings 'uninitialized';
  2         5  
  2         497  
24 0 0 0     0 return (($db->validate_boolean_keyword($value) && $db->should_inline_boolean_keyword($value)) ||
25             ($db->keyword_function_calls && $value =~ /^\w+\(.*\)$/)) ? 1 : 0;
26             }
27              
28             sub perl_column_definition_attributes
29             {
30 0     0 0 0 grep { $_ ne 'length' } shift->SUPER::perl_column_definition_attributes;
  0         0  
31             }
32              
33             sub method_uses_formatted_key
34             {
35 4     4 0 8 my($self, $type) = @_;
36 4 50 33     40 return 1 if($type eq 'get' || $type eq 'set' || $type eq 'get_set');
      33        
37 0           return 0;
38             }
39              
40             1;
41              
42             __END__
43              
44             =head1 NAME
45              
46             Rose::DB::Object::Metadata::Column::Boolean - Boolean column metadata.
47              
48             =head1 SYNOPSIS
49              
50             use Rose::DB::Object::Metadata::Column::Boolean;
51              
52             $col = Rose::DB::Object::Metadata::Column::Boolean->new(...);
53             $col->make_methods(...);
54             ...
55              
56             =head1 DESCRIPTION
57              
58             Objects of this class store and manipulate metadata for boolean columns in a database. Column metadata objects store information about columns (data type, size, etc.) and are responsible for creating object methods that manipulate column values.
59              
60             This class inherits from L<Rose::DB::Object::Metadata::Column::Scalar>. Inherited methods that are not overridden will not be documented a second time here. See the L<Rose::DB::Object::Metadata::Column::Scalar> documentation for more information.
61              
62             =head1 METHOD MAP
63              
64             =over 4
65              
66             =item C<get_set>
67              
68             L<Rose::DB::Object::MakeMethods::Generic>, L<boolean|Rose::DB::Object::MakeMethods::Generic/boolean>, ...
69              
70             =item C<get>
71              
72             L<Rose::DB::Object::MakeMethods::Generic>, L<boolean|Rose::DB::Object::MakeMethods::Generic/boolean>, ...
73              
74             =item C<get_set>
75              
76             L<Rose::DB::Object::MakeMethods::Generic>, L<boolean|Rose::DB::Object::MakeMethods::Generic/boolean>, ...
77              
78             =back
79              
80             See the L<Rose::DB::Object::Metadata::Column|Rose::DB::Object::Metadata::Column/"MAKING METHODS"> documentation for an explanation of this method map.
81              
82             =head1 OBJECT METHODS
83              
84             =over 4
85              
86             =item B<parse_value DB, VALUE>
87              
88             Parse VALUE and return true or false according to how the underlying database would view VALUE as the value for a boolean column. DB is a L<Rose::DB> object that is used as part of the parsing process. Both arguments are required.
89              
90             =item B<type>
91              
92             Returns "boolean".
93              
94             =back
95              
96             =head1 AUTHOR
97              
98             John C. Siracusa (siracusa@gmail.com)
99              
100             =head1 LICENSE
101              
102             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is
103             free software; you can redistribute it and/or modify it under the same terms
104             as Perl itself.