File Coverage

blib/lib/Rose/DB/Object/Metadata/Column/Array.pm
Criterion Covered Total %
statement 18 25 72.0
branch 1 4 25.0
condition 2 9 22.2
subroutine 7 10 70.0
pod 4 5 80.0
total 32 53 60.3


line stmt bran cond sub pod time code
1             package Rose::DB::Object::Metadata::Column::Array;
2              
3 2     2   15 use strict;
  2         4  
  2         67  
4              
5 2     2   21 use Rose::Object::MakeMethods::Generic;
  2         4  
  2         15  
6 2     2   52 use Rose::DB::Object::MakeMethods::Generic;
  2         6  
  2         16  
7              
8 2     2   56 use Rose::DB::Object::Metadata::Column;
  2         5  
  2         347  
9             our @ISA = qw(Rose::DB::Object::Metadata::Column);
10              
11             our $VERSION = '0.788';
12              
13             __PACKAGE__->add_common_method_maker_argument_names
14             (
15             qw(default dimensions)
16             );
17              
18             Rose::Object::MakeMethods::Generic->make_methods
19             (
20             { preserve_existing => 1 },
21             scalar => [ __PACKAGE__->common_method_maker_argument_names ]
22             );
23              
24 4     4 1 19 sub type { 'array' }
25              
26             foreach my $type (__PACKAGE__->available_method_types)
27             {
28             __PACKAGE__->method_maker_type($type => 'array')
29             }
30              
31             sub should_inline_value
32             {
33 0     0 1 0 my($self, $db, $value) = @_;
34 2     2   16 no warnings 'uninitialized';
  2         4  
  2         498  
35 0 0 0     0 return (($db->validate_array_keyword($value) && $db->should_inline_array_keyword($value)) ||
36             ($db->keyword_function_calls && $value =~ /^\w+\(.*\)$/)) ? 1 : 0;
37             }
38              
39 0     0 1 0 sub parse_value { shift; shift->parse_array(@_) }
  0         0  
40 0     0 1 0 sub format_value { shift; shift->format_array(@_) }
  0         0  
41              
42             sub method_uses_formatted_key
43             {
44 1     1 0 3 my($self, $type) = @_;
45 1 50 33     23 return 1 if($type eq 'get' || $type eq 'set' || $type eq 'get_set');
      33        
46 0           return 0;
47             }
48              
49             1;
50              
51             __END__
52              
53             =head1 NAME
54              
55             Rose::DB::Object::Metadata::Column::Array - Array column metadata.
56              
57             =head1 SYNOPSIS
58              
59             use Rose::DB::Object::Metadata::Column::Array;
60              
61             $col = Rose::DB::Object::Metadata::Column::Array->new(...);
62             $col->make_methods(...);
63             ...
64              
65             =head1 DESCRIPTION
66              
67             Objects of this class store and manipulate metadata for array 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<array|Rose::DB::Object::MakeMethods::Generic/array>, ...
78              
79             =item C<get>
80              
81             L<Rose::DB::Object::MakeMethods::Generic>, L<array|Rose::DB::Object::MakeMethods::Generic/array>, ...
82              
83             =item C<get_set>
84              
85             L<Rose::DB::Object::MakeMethods::Generic>, L<array|Rose::DB::Object::MakeMethods::Generic/array>, ...
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<dimensions [ARRAYREF]>
96              
97             Get or set the dimensions of the column as a reference to an array of integer dimensions.
98              
99             =item B<parse_value DB, VALUE>
100              
101             Parse VALUE and return a reference to an array containing the array values. DB is a L<Rose::DB> object that is used as part of the parsing process. Both arguments are required.
102              
103             =item B<type>
104              
105             Returns "array".
106              
107             =back
108              
109             =head1 AUTHOR
110              
111             John C. Siracusa (siracusa@gmail.com)
112              
113             =head1 LICENSE
114              
115             Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is
116             free software; you can redistribute it and/or modify it under the same terms
117             as Perl itself.