File Coverage

blib/lib/ODS.pm
Criterion Covered Total %
statement 38 42 90.4
branch 1 2 50.0
condition n/a
subroutine 12 14 85.7
pod n/a
total 51 58 87.9


line stmt bran cond sub pod time code
1             package ODS;
2              
3 3     3   193037 use strict; use warnings;
  3     3   18  
  3         67  
  3         12  
  3         10  
  3         89  
4              
5             our $VERSION = '0.02';
6              
7 3     3   1046 use ODS::Table;
  3         9  
  3         84  
8 3     3   15 use Blessed::Merge;
  3         18  
  3         45  
9 3     3   17 use YAOO;
  3         6  
  3         34  
10              
11             sub import {
12 5     5   759 my $package = shift;
13 3     3   800 no strict 'refs';
  3         6  
  3         1014  
14 5         8 my $called = caller();
15 5         15 my $table = ODS::Table->new();
16 5         456 my $bm = Blessed::Merge->new(
17             blessed => 0,
18             same => 0
19             );
20 5     96   92 YAOO::make_keyword($called, "true", sub { 1; });
  96         502  
21 5     0   55 YAOO::make_keyword($called, "false", sub { 0; });
  0         0  
22             YAOO::make_keyword($called, "name", sub {
23 4     4   928 my (@args) = @_;
24 4         13 $table->name(@args);
25 5         42 });
26             YAOO::make_keyword($called, "options", sub {
27 4     4   49 my (%args) = @_;
28 4         8 $table->options($bm->merge($table->options, \%args));
29 5         40 });
30             YAOO::make_keyword($called, "column", sub {
31 36     36   70 my (@args) = @_;
32 36 50       62 if (!$table->name) {
33 0         0 $table->name([split "\:\:", $called]->[-1]);
34             }
35 36         216 $table->add_column(@args);
36 5         38 });
37             YAOO::make_keyword($called, "storage_class", sub {
38 0     0   0 my (@args) = @_;
39 0         0 $table->storage_class(pop @args);
40 5         38 });
41             YAOO::make_keyword($called, "connect", sub {
42 4     4   216 return $table->connect(@_);
43 5         33 });
44             }
45              
46             =head1 NAME
47              
48             ODS - Object Data Store
49              
50             =head1 VERSION
51              
52             Version 0.02
53              
54             =cut
55              
56             =head1 SYNOPSIS
57              
58             package Table::Court;
59              
60             use ODS;
61              
62             name "user";
63              
64             options (
65             custom => 1
66             );
67              
68             column id => (
69             type => "integer",
70             auto_increment => true,
71             mandatory => true,
72             filterable => true,
73             sortable => true,
74             no_render => true
75             );
76              
77             column first_name => (
78             type => "string",
79             mandatory => true,
80             filterable => true,
81             sortable => true,
82             );
83              
84             column last_name => (
85             type => "string",
86             mandatory => true,
87             filterable => true,
88             sortable => true,
89             );
90              
91             column diagnosis => (
92             type => "string",
93             mandatory => true,
94             filterable => true,
95             sortable => true,
96             );
97              
98             1;
99              
100             ...
101              
102             package ResultSet::Court;
103              
104             use YAOO;
105              
106             extends 'ODS::Table::ResultSet";
107              
108             has people => isa(string);
109              
110             has miss_diagnosis => isa(object);
111            
112             sub licenced_doctors {
113             my ($self, %name) = @_;
114              
115             $self->miss_diagnosis($self->find(
116             %name
117             ));
118             }
119              
120             ...
121              
122             package Row::Court;
123              
124             use YAOO;
125              
126             extends 'ODS::Table::Row';
127              
128             has barrister => isa(string);
129              
130             ...
131              
132             my $data = Table::Court->connect('File::YAML', {
133             file => 't/filedb/patients'
134             });
135              
136             my $all = $data->all();
137              
138             my $misdiagnosis = $data->licenced_doctors({ first_name => 'Anonymous', last_name => 'Object' });
139              
140             $miss_diagnosis->update(
141             diagnosis => 'psychosis'
142             );
143              
144             =head1 AUTHOR
145              
146             LNATION, C<< >>
147              
148             =head1 BUGS
149              
150             Please report any bugs or feature requests to C, or through
151             the web interface at L. I will be notified, and then you'll
152             automatically be notified of progress on your bug as I make changes.
153              
154             =head1 SUPPORT
155              
156             You can find documentation for this module with the perldoc command.
157              
158             perldoc ODS
159              
160              
161             You can also look for information at:
162              
163             =over 4
164              
165             =item * RT: CPAN's request tracker (report bugs here)
166              
167             L
168              
169             =item * CPAN Ratings
170              
171             L
172              
173             =item * Search CPAN
174              
175             L
176              
177             =back
178              
179              
180             =head1 ACKNOWLEDGEMENTS
181              
182              
183             =head1 LICENSE AND COPYRIGHT
184              
185             This software is Copyright (c) 2022 by LNATION.
186              
187             This is free software, licensed under:
188              
189             The Artistic License 2.0 (GPL Compatible)
190              
191              
192             =cut
193              
194             1; # End of ODS