ODS.pm

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