File Coverage

blib/lib/ODS.pm
Criterion Covered Total %
statement 45 49 91.8
branch 2 4 50.0
condition n/a
subroutine 15 16 93.7
pod n/a
total 62 69 89.8


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