File Coverage

lib/Device/ParallelPort/drv/dummy_byte.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 2 4 50.0
total 29 31 93.5


line stmt bran cond sub pod time code
1             package Device::ParallelPort::drv::dummy_byte;
2 1     1   7 use strict;
  1         2  
  1         48  
3 1     1   6 use Carp;
  1         2  
  1         110  
4              
5             =head1 NAME
6              
7             Device::ParallelPort::drv::dummy_byte - Dummy driver. Pretend to work.
8              
9             =head1 DESCRIPTION
10              
11             This is purely used for testing the system and not really useful.
12              
13             =head1 CAPABILITIES
14              
15             None what so ever. Basically just store bytes in an array !
16              
17             =head1 COPYRIGHT
18              
19             Copyright (c) 2002,2004 Scott Penrose. All rights reserved.
20             This program is free software; you can redistribute it and/or modify
21             it under the same terms as Perl itself.
22              
23             =head1 AUTHOR
24              
25             Scott Penrose L, L
26              
27             =head1 SEE ALSO
28              
29             L
30              
31             =cut
32              
33 1     1   6 use base qw/Device::ParallelPort::drv/;
  1         2  
  1         922  
34              
35             sub init {
36 1     1 0 9 my ($this, @params) = @_;
37 1         15 $this->{BYTES} = [];
38             }
39              
40             sub INFO {
41             return {
42 9     9 0 60 'os' => 'any',
43             'type' => 'byte',
44             };
45             }
46              
47             sub set_byte {
48 4     4 1 8 my ($this, $byte, $val) = @_;
49 4         12 $this->{BYTES}[$byte] = $val;
50             }
51              
52             sub get_byte {
53 15     15 1 22 my ($this, $byte) = @_;
54 15 100       43 if (!defined($this->{BYTES}[$byte])) {
55 2         4 $this->{BYTES}[$byte] = chr(0);
56             }
57 15         282 return $this->{BYTES}[$byte];
58             }
59              
60             1;
61