blib/lib/Palm/ThinkDB.pm

filter: Statementstmt 71.2% 178 / 250 Branchbran 70.0% 70 / 100 Conditioncond 77.7% 7 / 9 MC/DCmcdc 66.6% 4 / 6 Subroutinesub 78.9% 15 / 19 Podpod 30.7% 4 / 13 totaltotal 70.0% 278 / 397 CC 56 SCAR 29.8
CC
56
Cov
71%
ParseRecord
36.4
PackRecord
21.5
get_colarray
20.0
CRAP 19.8
↑ Summary
1 # Palm::ThinkDB by Erik Arneson <erik@aarg.net>
2 #
3 # Perl class for dealing with ThinkDB databases.
4 #
5 # Copyright (C) 2001 Erik Arneson
6 # You may distribute this file under the terms of the Artistic
7 # License, as specified in the README file.
8 #
9 # $Id: ThinkDB.pm,v 1.8 2001/06/12 20:11:10 erik Exp $
10  
11 package Palm::ThinkDB;
12  
13 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Palm::Raw ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Palm::StdAppInfo ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 our $VERSION = '0.02';
18 1 our $DEBUG = 0;
19 1 our (@ISA);
20  
21 1 @ISA = qw(Palm::PDB Palm::Raw Palm::StdAppInfo);
22  
23 1 ▶sub import {
Subroutine import: called CC=1 SCAR=0.0
24 1 &Palm::PDB::RegisterPDBHandlers(__PACKAGE__,
25 [qw(THNK data)]);
26 }
27  
28 # Can't really create a new DB yet.
29 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
30 0 return {};
31 }
32  
33 1 ▶sub new_Record {
Subroutine new_Record: called CC=1 SCAR=0.0
Pod documented
34 1 my $class = shift;
35 1 my $record = $class->SUPER::new_Record(@_);
36  
37 # What exactly do we need to initialize?
38 1 $record->{category} = 0;
39 1 $record->{data} = '';
40 # This has to be a database record type, as we can't really handle
41 # anything else.
42 1 $record->{type} = 87;
43  
44 1 return $record;
45 }
46  
47 197 ▶sub ParseRecord {
Subroutine ParseRecord: called CC=25 SCAR=35.9
Pod documented
48 197 my $self = shift;
49 197 my %record = @_;
50 197 my $data = $record{data};
51  
52 197 delete $record{offset}; # apparently this is useless!
53 #delete $record{data};
54  
55 197 my ($record_type, $rec);
56
57 197 $record_type = unpack "C", $data;
58
59 # Column names! Yowch.
60 197 ▶ if ($record_type == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if ($record_type == 1) { } 2 195 197
elsif ($record_type > 2 and $record_type < 82) { } 158 37 195
elsif ($record_type == 87) { } 23 14 37
61 2 my ($numcols, @trash, $tcnum, $tctype, $tcname, $tidx);
62 2 _debug_print("Columns:\n");
63 2 $data = substr $data, 1;
64 2 ($numcols, @trash) = unpack("C13", $data);
65 2 $data = substr($data, index($data, "\000", 14));
66 2 $numcols--;
67 2 ▶ for (my $i = 1; $i <= $numcols; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $numcols) 18 2 20
68 18 (@trash[0..1], $tcnum, $tctype, @trash[0..9]) = unpack("C13", $data);
69 18 $tidx = index($data, "\000", 14);
70 18 $tcname = substr($data, 14, $tidx - 14);
71 18 _debug_printf(" i: $i colnum: %03d coltype: %02d colname: '%s'\n", $tcnum, $tctype, $tcname);
72 18 $self->{cols}[$tcnum]{type} = $tctype;
73 18 $self->{cols}[$tcnum]{name} = $tcname;
74  
75 18 $data = substr $data, $tidx;
76 }
77 2 _debug_print("\n");
78 }
79 # List items
80 ▶ elsif ($record_type > 2 &&
Condition100%3/3
$record_type > 2 and $record_type < 82
!ll&&!rl&&r
433158
MC/DC100%2/2
$record_type > 2 and $record_type < 82
$record_type > 2 $record_type < 82
Truth table100%3/3
A and B
A= $record_type > 2B= $record_type < 82
ABresult
0X0
100
111
81 $record_type < 82) {
82 158 my (@list, $colid, $num, @order);
83 158 $data = substr $data, 1;
84 158 $colid = $record_type - 2;
85 158 ($num) = unpack("C", $data);
86 158 ▶ if ($num > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num > 0) 4 154 158
87 4 (@order) = unpack("C$num", $data);
88 4 (@list) = split("\000", substr($data, $num + 1), $num + 1);
89 # get rid of trailing garbage!
90 4 pop @list;
91 # Sort according to order? Not needed -- only for aesthetics
92 #(@list) = @list[sort { $order[$a] <=> $order[$b] } 0 .. $#list];
93  
94 4 $self->{list}{$colid} = \@list;
95
96 4 _debug_print("Record ID: ", $record{id}, "\n",
97 " List Record for Column $colid\n",
98 " Ordering: ", join(", ", @order), "\n",
99 " Items: ", join(", ", @list), "\n",
100 " Data: ", safestr($data), "\n");
101 }
102 }
103 # The big one: a database record.
104 elsif ($record_type == 87) {
105 23 _debug_print( "Record ID: ", $record{id}, "\n");
106 23 _debug_print( " Record Cat: ", $record{category}, "\n");
107  
108 # Unpack a record
109 23 my $foo;
110 23 my ($type, $id) = unpack "CxN", $data;
111 23 _debug_printf(" type: %d id: %d\n", $type, $id);
112 23 $data = substr $data, 6;
113  
114 23 $record{idnum} = $id;
115 23 ▶ if ($id > $self->{high_id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id > $self->{"high_id"}) 23 0 23
116 23 $self->{high_id} = $id;
117 }
118
119 23 ▶ while (length($data) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $data > 0) 81 23 104
120 81 my ($ctype, $cid) = unpack "C2", $data;
121 81 $data = substr $data, 2;
122 # First are normal string types.
123 81 ▶ if ($ctype == 1) {
Branch: 13 branches
BranchTrueFalseTotal
if ($ctype == 1) { } 22 59 81
elsif ($ctype == 2) { } 22 37 59
elsif ($ctype == 3) { } 2 35 37
elsif ($ctype == 4) { } 2 33 35
elsif ($ctype == 5) { } 4 29 33
elsif ($ctype == 6) { } 0 29 29
elsif ($ctype == 7) { } 2 27 29
elsif ($ctype == 8) { } 2 25 27
elsif ($ctype == 9) { } 0 25 25
elsif ($ctype == 10) { } 2 23 25
elsif ($ctype == 12) { } 0 23 23
elsif ($ctype == 15) { } 0 23 23
elsif ($ctype == 19) { } 0 23 23
124 #my ($slen) = unpack "C", $data;
125 22 my ($sdat) = unpack "C/a", $data;
126 22 my $slen = length($sdat);
127 22 _debug_printf(" (text)col: %02d strlen: %02d data: '%s'\n", $cid, $slen, $sdat);
128 22 $record{col}{$cid} = $sdat;
129 22 $data = substr $data, $slen+2;
130 }
131 # Integer types.
132 elsif ($ctype == 2) {
133 # Integer
134 22 my ($val) = unpack("n", $data);
135 22 _debug_printf(" col: %02d data: %d\n", $cid, $val);
136 22 $record{col}{$cid} = $val;
137 22 $data = substr $data, 2;
138 }
139 # Long
140 elsif ($ctype == 3) {
141 2 my ($val) = unpack("N", $data);
142 2 _debug_printf(" col: %02d data: %d\n", $cid, $val);
143 2 $record{col}{$cid} = $val;
144 2 $data = substr $data, 4;
145 }
146 # Float
147 elsif ($ctype == 4) {
148 2 my (@val) = unpack("s2", $data);
149 2 _debug_printf(" col: %02d data: %s\n", $cid, join(',', @val));
150 2 $record{col}{$cid} = $val[0];
151 2 $record{raw}{$cid} = substr $data, 0, 4;
152 2 $data = substr $data, 4;
153 }
154 # List!
155 elsif ($ctype == 5) {
156 4 my ($val) = unpack("C", $data);
157 4 $record{col}{$cid} = $self->{list}{$cid}[$val - 1];
158 _debug_printf(" col: %02d idx: %d val: '%s'\n",
159 4 $cid, $val, $record{col}{$cid});
160 4 $data = substr $data, 1;
161 }
162 # Checkbox
163 elsif ($ctype == 6) {
164 0 my ($val) = unpack("C", $data);
165 0 ▶ _debug_printf(" col: %02d checked: %s\n", $cid, ($val) ? 'yes' : 'no');
Branch: 1 branch
BranchTrueFalseTotal
$val ? : 0 0 0
166 0 $record{col}{$cid} = $val;
167 0 $data = substr $data, 1;
168 }
169 # Date
170 elsif ($ctype == 7) {
171 2 my ($year, $month, $day) = unpack "nCC", $data;
172 2 _debug_print(" col: $cid date: $day/$month/$year\n");
173 2 $record{col}{$cid} = sprintf("%02d/%02d/%04d",
174 $day, $month, $year);
175 2 $data = substr $data, 4;
176 }
177 # Time
178 elsif ($ctype == 8) {
179 # Meridian doesn't seem to get used. Just a null byte?
180 2 my ($meridian, $hour, $minute, $second) = unpack("C4", $data);
181 2 _debug_printf(" col: %02d time: %02d:%02d:%02d %d\n", $cid,
182 $hour, $minute, $second, $meridian);
183 2 $record{col}{$cid} = sprintf("%02d:%02d:%02d", $hour, $minute, $second);
184 2 $data = substr $data, 4;
185 }
186 # Equation type
187 elsif ($ctype == 9) {
188 # We aren't going to do anything with these.
189 0 _debug_printf(" * equation type found\n");
190 0 $record{raw}{$cid} = substr $data, 0, 4;
191 0 $data = substr $data, 4;
192 }
193 # Memo field types.
194 elsif ($ctype == 10) {
195 2 my ($sdat, $slen);
196 2 ($sdat) = unpack "n/a", $data;
197 2 $slen = length($sdat);
198 2 _debug_printf(" col: %02d strlen: %02d data: '%s'\n",
199 $cid, $slen, $sdat);
200 2 $record{col}{$cid} = $sdat;
201 2 $data = substr $data, $slen+3;
202 }
203 # Foreign link types.
204 elsif ($ctype == 12) {
205 0 my ($ltype, $slen, $sdat);
206 0 ($ltype) = unpack "C", $data;
207 0 ▶ if ($ltype == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ltype == 1) { } 0 0 0
elsif ($ltype == 11) { } 0 0 0
208 # Link is stored as text!
209 0 ($ltype, $sdat) = unpack "CC/a", $data;
210 0 $slen = length($sdat);
211 0 _debug_printf(" col: %02d strlen: %02d foo: %02d data: '%s'\n",
212 $cid, $slen, $ltype, $sdat);
213 0 $record{col}{$cid} = $sdat;
214 0 $record{raw}{$cid} = substr $data, 0, $slen + 3;
215 0 $data = substr $data, $slen+3;
216 } elsif ($ltype == 11) {
217 # What does this signify? Addressbook link?
218 0 ($ltype, $sdat) = unpack "C N", $data;
219 0 _debug_printf(" col: %02d ltype: %02d data: '%s'\n", $cid, $ltype, $sdat);
220 0 $record{col}{$cid} = $sdat;
221 0 $record{raw}{$cid} = substr $data, 0, 5;
222 0 $data = substr $data, 5;
223 } else {
224 0 _debug_print(" Column type: $ctype Column ID: $cid\n",
225 " Link Type: $ltype\n",
226 " Record data: ", safestr($data), "\n");
227 0 $data = '';
228 }
229 }
230 # Addressbook link
231 elsif ($ctype == 15) {
232 0 my (@foo, $slen, $sdat);
233 0 (@foo[0 .. 3], $sdat) = unpack "C4C/a", $data;
234 0 $slen = length($sdat);
235 0 _debug_printf(" col: %02d foo: [%s] data: '%s'\n", $cid, join(',',@foo), $sdat);
236 0 $record{col}{$cid} = $sdat;
237 0 $record{raw}{$cid} = substr $data, 0, $slen + 6;
238 0 $data = substr $data, $slen+6;
239 }
240 # Another equation sort of thing.
241 elsif ($ctype == 19) {
242 # We can't do anything with these, either.
243 0 _debug_printf(" * type 19 thingie found\n");
244 0 $record{raw}{$cid} = substr $data, 0, 5;
245 0 $data = substr($data, 5);
246 } else {
247 23 _debug_print(" Column type: $ctype\n",
248 " Column ID: $cid\n",
249 " Record data: ", safestr($data), "\n");
250 23 $data = '';
251 }
252 }
253 23 push @{$self->{db_records}}, \%record;
254 } else {
255 #_debug_print " Column type: $ctype\n";
256 #_debug_print " Column ID: $cid\n";
257 14 _debug_print(" Record data: ", safestr($record{data}), "\n");
258 14 $data = '';
259 }
260  
261 197 $record{type} = $record_type;
262  
263 197 return \%record;
264 }
265  
266 # This one is going to be tricky!
267 99 ▶sub PackRecord {
Subroutine PackRecord: called CC=18 SCAR=30.7
Pod documented
268 99 my $self = shift @_;
269 99 my $record = shift @_;
270 99 my ($retval, $ctype);
271  
272 # Create/pack our list record.
273 99 ▶ if ($record->{type} > 2 && $record->{type} < 82) {
Branch: 2 branches
BranchTrueFalseTotal
if ($record->{'type'} > 2 and $record->{'type'} < 82) { } 79 20 99
elsif ($record->{'type'} == 87) { } 12 8 20
Condition100%3/3
$record->{"type"} > 2 and $record->{"type"} < 82
!ll&&!rl&&r
31779
MC/DC100%2/2
$record->{"type"} > 2 and $record->{"type"} < 82
$record->{"type"} > 2 $record->{"type"} < 82
Truth table100%3/3
A and B
A= $record->{"type"} > 2B= $record->{"type"} < 82
ABresult
0X0
100
111
274 79 my $cid = $record->{type} - 2;
275 79 ▶ if (defined $self->{list_mod}{$cid} &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'list_mod'}{$cid} and $self->{'list_mod'}{$cid} == 1) { } 0 79 79
Condition33%1/3
defined $self->{"list_mod"}{$cid} and $self->{"list_mod"}{$cid} == 1
!ll&&!rl&&r
7900
MC/DC0%0/2
defined $self->{"list_mod"}{$cid} and $self->{"list_mod"}{$cid} == 1
defined $self->{"list_mod"}{$cid} $self->{"list_mod"}{$cid} == 1
Truth table33%1/3
A and B
A= defined $self->{"list_mod"}{$cid}B= $self->{"list_mod"}{$cid} == 1
ABresult
0X0
100
111
276 $self->{list_mod}{$cid} == 1) {
277 0 _debug_print("modified\n");
278 0 my $num = scalar(@{$self->{list}{$cid}});
279 0 $retval = pack("C*", $record->{type}, $num, 1 .. $num);
280 0 $retval .= join("\000", @{$self->{list}{$cid}});
281 0 $retval .= "\000\000";
282 0 _debug_print("RETVAL: ", safestr($retval), "\n");
283 0 _debug_print("DATA: ", safestr($record->{data}), "\n");
284 } else {
285 79 $retval = $record->{data};
286 }
287 }
288 # Initialize data type.
289 elsif ($record->{type} == 87) {
290 12 ▶ if (!defined $record->{idnum}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $record->{"idnum"}) 1 11 12
291 1 $record->{idnum} = ++$self->{high_id};
292 }
293
294 12 $retval = pack("CxN", 87, $record->{idnum});
295 12 foreach my $field (sort { $a <=> $b } keys %{$record->{col}}) {
296 29 $ctype = $self->{cols}[$field]{type};
297  
298 # Pack type for this column.
299 29 $retval .= pack("C2", $ctype, $field);
300  
301 # Pack column data.
302 # Normal text.
303 29 ▶ if ($ctype == 1) {
Branch: 8 branches
BranchTrueFalseTotal
if ($ctype == 1) { } 11 18 29
elsif ($ctype == 2) { } 11 7 18
elsif ($ctype == 3) { } 1 6 7
elsif ($ctype == 5) { } 2 4 6
elsif ($ctype == 6) { } 0 4 4
elsif ($ctype == 7) { } 1 3 4
elsif ($ctype == 8) { } 1 2 3
elsif ($ctype == 10) { } 1 1 2
304 11 $retval .= pack("C/a*x", $record->{col}{$field});
305 }
306 # Integer
307 elsif ($ctype == 2) {
308 11 $retval .= pack("n", $record->{col}{$field});
309 }
310 # Long
311 elsif ($ctype == 3) {
312 1 $retval .= pack("N", $record->{col}{$field});
313 }
314 # List
315 elsif ($ctype == 5) {
316 2 $retval .= pack("C", $self->list_lookup($field, $record->{col}{$field}));
317 }
318 # Checkbox
319 elsif ($ctype == 6) {
320 0 ▶ $retval .= pack("C", ($record->{col}{$field}) ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$record->{'col'}{$field} ? : 0 0 0
321 }
322 # Date
323 elsif ($ctype == 7) {
324 1 my (@date) = split('/',$record->{col}{$field});
325 1 $retval .= pack("nCC", int($date[2]), int($date[1]), int($date[0]));
326 }
327 # Time
328 elsif ($ctype == 8) {
329 # Why the null byte here?
330 1 my (@time) = split(':', $record->{col}{$field});
331 1 $retval .= pack("xC3", @time);
332 }
333 # Memo
334 elsif ($ctype == 10) {
335 1 $retval .= pack("n/a*x", $record->{col}{$field});
336 }
337 # Something we don't know about yet.
338 else {
339 # What do we do with 9, 12, 15, and 19? Especially 12 and 15.
340 # We can't handle it, so we just pass the data through.
341 1 _debug_print("Found record I don't know, $field, $ctype\n");
342 1 $retval .= $record->{raw}{$field};
343 }
344 }
345  
346 12 ▶ if ($retval ne $record->{data}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($retval ne $record->{"data"}) 12 0 12
347 12 $retval .= "\000\000\000"; # Signals end of record, or something?
348 }
349
350 _debug_print("RETVAL: ", safestr($retval), "\n",
351 12 "DATA: ", safestr($record->{data}), "\n");
352 } else {
353 8 _debug_print("*RETVAL: ", safestr($record->{data}), "\n");
354 8 $retval = $record->{data};
355 }
356  
357 99 return $retval;
358  
359 }
360  
361 # Special stuff.
362 1 ▶sub db_records {
Subroutine db_records: called CC=1 SCAR=0.0
Pod undocumented
363 1 my $self = shift;
364  
365 1 return @{$self->{db_records}};
366 }
367  
368 2 ▶sub get_colnum {
Subroutine get_colnum: called CC=3 SCAR=11.2
Pod undocumented
369 2 my $self = shift;
370 2 my $name = shift;
371  
372 2 ▶ for (my $i = 1; $i <= $#{$self->{cols}}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$self{"cols"};}) 18 2 20
373 18 ▶ if ($self->{cols}[$i]{name} eq $name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"cols"}[$i]{"name"} eq $name) 0 18 18
374 0 return $i;
375 }
376 }
377  
378 2 return -1;
379 }
380  
381 0 ▶sub get_colarray {
Subroutine get_colarray: not called CC=4 SCAR=30.0
Pod undocumented
382 0 my $self = shift;
383 0 my $name = shift;
384 0 my $cid = $self->get_colnum($name);
385 0 my @ret;
386  
387 0 foreach my $rec (@{$self->{records}}) {
388 0 ▶ if ($rec->{type} == 87) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rec->{"type"} == 87) 0 0 0
389 push @ret, $rec->{col}{$cid}
390 0 ▶ unless $rec->{attributes}{deleted};
Branch: 1 branch
BranchTrueFalseTotal
unless $rec->{"attributes"}{"deleted"} 0 0 0
391 }
392 }
393  
394 0 return @ret;
395 }
396  
397 2 ▶sub columns {
Subroutine columns: called CC=3 SCAR=11.0
Pod undocumented
398 2 my $self = shift;
399 2 my @ret;
400
401 2 ▶ for (my $i = 0; $i <= $#{$self->{cols}}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$self{"cols"};}) 20 2 22
402 20 ▶ if (defined $self->{cols}[$i]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"cols"}[$i]) 18 2 20
403 18 push @ret, $self->{cols}[$i]{name};
404 }
405 }
406  
407 2 return @ret;
408 }
409  
410 # Modify lists
411 2 ▶sub list_lookup {
Subroutine list_lookup: called CC=3 SCAR=11.1
Pod undocumented
412 2 my $self = shift;
413 2 my $cid = shift;
414 2 my $txt = shift;
415  
416 2 ▶ for (my $i = 0; $i <= $#{$self->{list}{$cid}}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$self{"list"}{$cid};}) 4 0 4
417 4 ▶ if ($self->{list}{$cid}[$i] eq $txt) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"list"}{$cid}[$i] eq $txt) 2 2 4
418 2 return $i + 1;
419 }
420 }
421 0 return 0;
422 }
423  
424 0 ▶sub add_to_list {
Subroutine add_to_list: not called CC=1 SCAR=6.9
Pod undocumented
425 0 my $self = shift;
426 0 my $cid = shift;
427 0 my $item = shift;
428  
429 0 _debug_print("Adding $item to $cid\n");
430 0 push @{$self->{list}{$cid}}, $item;
431 0 $self->{list_mod}{$cid} = 1;
432 }
433  
434 # Messy. Called as $self->set($record, $column_name, $value);
435 2 ▶sub set {
Subroutine set: called CC=2 SCAR=7.1
Pod undocumented
436 2 my $self = shift;
437 2 my $record = shift;
438 2 my $column = shift;
439 2 my $data = shift;
440  
441 2 my $cnum = $self->get_colnum($column);
442  
443 2 ▶ if ($cnum > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cnum > 0) 0 2 2
444 0 $record->{col}{$cnum} = $data;
445 }
446 }
447  
448 0 ▶sub get {
Subroutine get: not called CC=3 SCAR=24.8
Pod undocumented
449 0 my $self = shift;
450 0 my $record = shift;
451 0 my $column = shift;
452  
453 0 my $cnum = $self->get_colnum($column);
454  
455 0 ▶ if ($cnum > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cnum > 0) { } 0 0 0
456 0 ▶ if (defined $record->{col}{$cnum}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $record->{'col'}{$cnum}) { } 0 0 0
457 0 return $record->{col}{$cnum};
458 } else {
459 0 return '';
460 }
461 } else {
462 0 return undef;
463 }
464 }
465  
466  
467 97 ▶sub _debug_printf {
Subroutine _debug_printf: called CC=2 SCAR=7.6
468 97 ▶ printf STDERR @_ if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Palm::ThinkDB::DEBUG 0 97 97
469 }
470  
471 114 ▶sub _debug_print {
Subroutine _debug_print: called CC=2 SCAR=7.6
472 114 ▶ print STDERR @_ if $DEBUG;
Branch: 1 branch
BranchTrueFalseTotal
if $Palm::ThinkDB::DEBUG 0 114 114
473 }
474  
475 73 ▶sub safestr ($) {
Subroutine safestr: called CC=1 SCAR=0.0
Pod undocumented
476 73 my $tmp = shift;
477
478 73 $tmp =~ s/([^a-zA-Z0-9\!\?\+\'\" ])/unpack("C", $1) . '.'/eg;
479  
480 73 return $tmp;
481 }
482  
483 1 1;
484 __END__
↑ Summary