ODS.pm

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