File Coverage

blib/lib/Rose/DB/Object/Metadata/Column/Scalar.pm
Criterion Covered Total %
statement 13 17 76.4
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 2 0.0
total 18 25 72.0


line stmt bran cond sub pod time code
1             package Rose::DB::Object::Metadata::Column::Scalar;
2              
3 61     61   472 use strict;
  61         149  
  61         2303  
4              
5 61     61   389 use Rose::Object::MakeMethods::Generic;
  61         239  
  61         519  
6              
7 61     61   1592 use Rose::DB::Object::Metadata::Column;
  61         150  
  61         3513  
8             our @ISA = qw(Rose::DB::Object::Metadata::Column);
9              
10             our $VERSION = '0.60';
11              
12             use Rose::Class::MakeMethods::Generic
13             (
14 61         570 inheritable_scalar => 'default_overflow',
15 61     61   434 );
  61         154  
16              
17             __PACKAGE__->default_overflow('fatal');
18              
19             __PACKAGE__->add_common_method_maker_argument_names
20             (
21             qw(default length check_in with_init init_method overflow)
22             );
23              
24             Rose::Object::MakeMethods::Generic->make_methods
25             (
26             { preserve_existing => 1 },
27              
28             'scalar --get_set_init' =>
29             [
30             overflow => { check_in => [ qw(truncate warn fatal) ] },
31             ],
32              
33             scalar => [ __PACKAGE__->common_method_maker_argument_names ]
34             );
35              
36             sub init_with_dbi_column_info
37             {
38 0     0 0 0 my($self, $col_info) = @_;
39              
40 0         0 $self->SUPER::init_with_dbi_column_info($col_info);
41              
42 0         0 $self->length($col_info->{'COLUMN_SIZE'});
43              
44 0         0 return;
45             }
46              
47 179     179 0 1540 sub init_overflow { __PACKAGE__->default_overflow }
48              
49             1;
50              
51             __END__
52              
53             =head1 NAME
54              
55             Rose::DB::Object::Metadata::Column::Scalar - Scalar column metadata.
56              
57             =head1 SYNOPSIS
58              
59             use Rose::DB::Object::Metadata::Column::Scalar;
60              
61             $col = Rose::DB::Object::Metadata::Column::Scalar->new(...);
62             $col->make_methods(...);
63             ...
64              
65             =head1 DESCRIPTION
66              
67             Objects of this class store and manipulate metadata for scalar 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.
68              
69             This class inherits from L<Rose::DB::Object::Metadata::Column>. Inherited methods that are not overridden will not be documented a second time here. See the L<Rose::DB::Object::Metadata::Column> documentation for more information.
70              
71             =head1 METHOD MAP
72              
73             =over 4
74              
75             =item C<get_set>
76              
77             L<Rose::DB::Object::MakeMethods::Generic>, L<scalar|Rose::DB::Object::MakeMethods::Generic/scalar>, C<interface =E<gt> 'get_set', ...>
78              
79             =item C<get>
80              
81             L<Rose::DB::Object::MakeMethods::Generic>, L<scalar|Rose::DB::Object::MakeMethods::Generic/scalar>, C<interface =E<gt> 'get', ...>
82              
83             =item C<get_set>
84              
85             L<Rose::DB::Object::MakeMethods::Generic>, L<scalar|Rose::DB::Object::MakeMethods::Generic/scalar>, C<interface =E<gt> 'set', ...>
86              
87             =back
88              
89             See the L<Rose::DB::Object::Metadata::Column|Rose::DB::Object::Metadata::Column/"MAKING METHODS"> documentation for an explanation of this method map.
90              
91             =head1 OBJECT METHODS
92              
93             =over 4
94              
95             =item B<check_in [ARRAYREF]>
96              
97             Get or set a reference to an array of valid column values.
98              
99             =item B<default VALUE>
100              
101             Get or set the default value for the column.
102              
103             =item B<init_method [NAME]>
104              
105             Get or set the name of the "init" method. See the documentation for the C<scalar> method type in L<Rose::DB::Object::MakeMethods::Generic> for more information.
106              
107             =item B<length [INT]>
108              
109             Get or set the length of the column in characters.
110              
111             =item B<overflow [BEHAVIOR]>
112              
113             Get or set the setting that determines the behavior when the column value is greater than L<length|/length> characters. Valid values for BEHAVIOR are:
114              
115             =over 4
116              
117             =item B<fatal>
118              
119             Throw an exception.
120              
121             =item B<truncate>
122              
123             Truncate the column value to the correct L<length|/length>.
124              
125             =item B<warn>
126              
127             Print a warning message.
128              
129             =back
130              
131             The default value is "fatal".
132              
133             =item B<type>
134              
135             Returns "scalar".
136              
137             =item B<with_init [BOOL]>
138              
139             Get or set the flag that determines whether or not the method created by C<make_method()> will include an "init" method as well. See the documentation for the L<scalar|Rose::DB::Object::MakeMethods::Generic/scalar> method type in L<Rose::DB::Object::MakeMethods::Generic> for more information.
140              
141             =back
142              
143             =head1 AUTHOR
144              
145             John C. Siracusa (siracusa@gmail.com)
146              
147             =head1 LICENSE
148              
149             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is
150             free software; you can redistribute it and/or modify it under the same terms
151             as Perl itself.