Planar/Schema/Result/DifferenceSet.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 28 / 28 CC 2 SCAR 3.4
CC
2
Cov
100%
main_elements
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Planar/Data.pm ↑ Summary Planar/Schema.pm »
1 package Math::DifferenceSet::Planar::Schema::Result::DifferenceSet;
2  
3 =head1 NAME
4  
5 Math::DifferenceSet::Planar::Schema::Result::DifferenceSet -
6 planar difference set database backend result class definition.
7  
8 =cut
9  
10 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 7 ▶use base 'DBIx::Class::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 VERSION
16  
17 This documentation refers to version 1.003 of
18 Math::DifferenceSet::Planar::Schema::Result::DifferenceSet.
19  
20 =cut
21  
22 7 our $VERSION = '1.003';
23  
24 =head1 TABLE: C<difference_set>
25  
26 =cut
27  
28 7 __PACKAGE__->table("difference_set");
29  
30 =head1 ACCESSORS
31  
32 =head2 order
33  
34 data_type: 'integer'
35 is_nullable: 0
36  
37 =head2 base
38  
39 data_type: 'integer'
40 is_nullable: 0
41  
42 =head2 ref_std
43  
44 data_type: 'integer'
45 is_nullable: 0
46  
47 =head2 ref_lex
48  
49 data_type: 'integer'
50 is_nullable: 0
51  
52 =head2 ref_gap
53  
54 data_type: 'integer'
55 is_nullable: 0
56  
57 =head2 delta_main
58  
59 data_type: 'blob'
60 is_nullable: 0
61  
62 =cut
63  
64 7 __PACKAGE__->add_columns(
65 "order_",
66 { accessor => "order", data_type => "integer", is_nullable => 0 },
67 "base",
68 { data_type => "integer", is_nullable => 0 },
69 "ref_std",
70 { data_type => "integer", is_nullable => 0 },
71 "ref_lex",
72 { data_type => "integer", is_nullable => 0 },
73 "ref_gap",
74 { data_type => "integer", is_nullable => 0 },
75 "delta_main",
76 { data_type => "blob", is_nullable => 0 },
77 );
78  
79 =head2 main_elements
80  
81 I<main_elements> is a wrapper for I<delta_main> generating an array of
82 elements values from the deltas raw data. It returns an array reference
83 if deltas are defined, otherwise undef.
84  
85 Unpacking delta_main raw data into element values is part of the resultset
86 API, as different implementations may employ different packing mechanisms.
87  
88 =cut
89  
90 20 ▶sub main_elements {
Subroutine main_elements: called CC=2 SCAR=6.9
Pod documented
91 20 my ($this) = @_;
92 20 my $delta_main = $this->delta_main;
93 20 ▶ return undef if !defined $delta_main;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $delta_main 1 19 20
94 19 my $sum = 0;
95 19 my @elements = map { $sum += $_ } unpack 'w*', $delta_main;
96 19 return \@elements;
97 }
98  
99 =head1 PRIMARY KEY
100  
101 =over 4
102  
103 =item * L</order>
104  
105 =back
106  
107 =cut
108  
109 7 __PACKAGE__->set_primary_key("order_");
110  
111 7 1;
112  
113 =head1 SEE ALSO
114  
115 =over 4
116  
117 =item *
118  
119 L<Math::DifferenceSet::Planar::Schema> - schema class.
120  
121 =item *
122  
123 L<Math::DifferenceSet::Planar::Data> - higher level data interface.
124  
125 =back
126  
127 =head1 AUTHOR
128  
129 Martin Becker, E<lt>becker-cpan-mp I<at> cozap.comE<gt>
130  
131 =head1 COPYRIGHT AND LICENSE
132  
133 Copyright (c) 2019-2025 by Martin Becker, Blaubeuren.
134  
135 This library is free software; you can distribute it and/or modify it
136 under the terms of the Artistic License 2.0 (see the LICENSE file).
137  
138 The license grants freedom for related software development but does
139 not cover incorporating code or documentation into AI training material.
140 Please contact the copyright holder if you want to use the library whole
141 or in part for other purposes than stated in the license.
142  
143 =head1 DISCLAIMER OF WARRANTY
144  
145 This library is distributed in the hope that it will be useful, but
146 without any warranty; without even the implied warranty of merchantability
147 or fitness for a particular purpose.
148  
149 =cut
« Planar/Data.pm ↑ Summary Planar/Schema.pm »