Field/timestamp.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 55 CC 2 SCAR 11.0
CC
2
Cov
0%
_read
6.0
_as_html_view
2.0
_as_html_edit_ro
2.0
CRAP 3.0
1 ############################################################################
2 #
3 # Win32::ASP::Field::timestamp - implements timestamp fields in the Win32-ASP-DB system
4 #
5 # Author: Toby Everett
6 # Revision: 0.02
7 # Last Change:
8 ############################################################################
9 # Copyright 1999, 2000 Toby Everett. All rights reserved.
10 #
11 # This file is distributed under the Artistic License. See
12 # http://www.ActiveState.com/corporate/artistic_license.htm or
13 # the license that comes with your perl distribution.
14 #
15 # For comments, questions, bugs or general interest, feel free to
16 # contact Toby Everett at teverett@alascom.att.com
17 ############################################################################
18
19 use Win32::ASP::Field;
20 use Error qw/:try/;
21 use Win32::ASP::Error;
22
23 package Win32::ASP::Field::timestamp;
24
25 @ISA = ('Win32::ASP::Field');
26
27 use strict;
28
29 sub _read {
30 my $self = shift;
31 my($record, $results, $columns) = @_;
32
33 my $name = $self->name;
34 ref($columns) and !$columns->{$name} and return;
35 $self->can_view($record) or return;
36 if ($results->Fields->Item($name)) {
37 my $temp = uc(unpack('H*', $results->Fields->Item($name)->Value));
38 $temp =~ s/^0+//;
39 $record->{orig}->{$name} = $temp;
40 }
41 }
42
43 sub _as_html_view {
44 my $self = shift;
45 my($record, $data) = @_;
46
47 return '';
48 }
49
50 sub _as_html_edit_ro {
51 my $self = shift;
52 my($record, $data) = @_;
53
54 my $formname = $self->formname;
55 my $value = $record->{$data}->{$self->name};
56
57 chomp(my $retval = <<ENDHTML);
58 <INPUT TYPE="HIDDEN" NAME="$formname" VALUE="$value">
59 ENDHTML
60 $retval .= $self->as_html_view;
61 return $retval;
62 }
63
64 1;