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 73     73   4126053 use strict; use warnings;
  73     73   598  
  73         1684  
  73         301  
  73         85  
  73         2914  
4              
5             our $VERSION = '0.04';
6              
7 73     73   26554 use ODS::Table;
  73         221  
  73         4540  
8 73     73   793 use Blessed::Merge;
  73         83  
  73         1996  
9 73     73   316 use YAOO;
  73         519  
  73         345  
10              
11             sub import {
12 88     88   7542 my $package = shift;
13 73     73   38909 no strict 'refs';
  73         88  
  73         33708  
14 88         388 my $called = caller();
15 88         423 my $table = ODS::Table->new();
16 88         17151 my $bm = Blessed::Merge->new(
17             blessed => 0,
18             same => 0
19             );
20 88     2735   3106 YAOO::make_keyword($called, "true", sub { 1; });
  2735         10730  
21 88     44   1877 YAOO::make_keyword($called, "false", sub { 0; });
  44         240  
22             YAOO::make_keyword($called, "name", sub {
23 87     87   27804 my (@args) = @_;
24 87         396 $table->name(@args);
25 88         938 });
26             YAOO::make_keyword($called, "options", sub {
27 86     86   1026 my (%args) = @_;
28 86         319 $table->options($bm->merge($table->options, \%args));
29 88         723 });
30             YAOO::make_keyword($called, "column", sub {
31 1104     1104   2568 my (@args) = @_;
32 1104 50       2056 if (!$table->name) {
33 0         0 $table->name([split "\:\:", $called]->[-1]);
34             }
35 1104         6667 $table->add_column(@args);
36 88         884 });
37             YAOO::make_keyword($called, "item", sub {
38 1     1   18 my (@args) = @_;
39 1 50       4 if (!$table->name) {
40 0         0 $table->name([split "\:\:", $called]->[-1]);
41             }
42 1         8 $table->add_item(@args);
43 88         794 });
44             YAOO::make_keyword($called, "storage_class", sub {
45 0     0   0 my (@args) = @_;
46 0         0 $table->storage_class(pop @args);
47 88         768 });
48             YAOO::make_keyword($called, "connect", sub {
49 142     142   32776 return $table->connect(@_);
50 88         796 });
51             YAOO::make_keyword($called, "instantiate", sub {
52 23     23   319 return $table->instantiate(@_);
53 88         944 });
54             }
55              
56             =head1 NAME
57              
58             ODS - Object Data Store
59              
60             =head1 VERSION
61              
62             Version 0.04
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 * CPAN Ratings
180              
181             L
182              
183             =item * Search CPAN
184              
185             L
186              
187             =back
188              
189              
190             =head1 ACKNOWLEDGEMENTS
191              
192              
193             =head1 LICENSE AND COPYRIGHT
194              
195             This software is Copyright (c) 2022 by LNATION.
196              
197             This is free software, licensed under:
198              
199             The Artistic License 2.0 (GPL Compatible)
200              
201              
202             =cut
203              
204             1; # End of ODS