File Coverage

blib/lib/Directory/Queue/Null.pm
Criterion Covered Total %
statement 21 32 65.6
branch 0 2 0.0
condition n/a
subroutine 9 19 47.3
pod 15 15 100.0
total 45 68 66.1


line stmt bran cond sub pod time code
1             #+##############################################################################
2             # #
3             # File: Directory/Queue/Null.pm #
4             # #
5             # Description: object oriented interface to a null directory based queue #
6             # #
7             #-##############################################################################
8              
9             #
10             # module definition
11             #
12              
13             package Directory::Queue::Null;
14 3     3   784 use strict;
  3         11  
  3         70  
15 3     3   12 use warnings;
  3         5  
  3         197  
16             our $VERSION = "2.0";
17             our $REVISION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
18              
19             #
20             # used modules
21             #
22              
23 3     3   405 use Directory::Queue qw();
  3         6  
  3         61  
24 3     3   30 use No::Worries::Die qw(dief);
  3         4  
  3         16  
25              
26             #
27             # inheritance
28             #
29              
30             our(@ISA) = qw(Directory::Queue);
31              
32             #
33             # object constructor
34             #
35              
36             sub new : method {
37 7     7 1 84 my($class) = @_;
38 7         9 my($self);
39              
40 7         35 $self = { path => "NULL", id => "NULL" };
41 7         16 bless($self, $class);
42 7         24 return($self);
43             }
44              
45             #
46             # dummy methods (they do almost nothing)
47             #
48              
49             sub first : method {
50 1     1 1 4 return("");
51             }
52              
53             sub next : method { ## no critic 'ProhibitBuiltinHomonyms'
54 1     1 1 3 return("");
55             }
56              
57             sub count : method {
58 2     2 1 10 return(0);
59             }
60              
61       0 1   sub purge : method {
62             }
63              
64             sub add : method {
65 2     2 1 3 return("");
66             }
67              
68             sub add_ref : method {
69 0     0 1   return("");
70             }
71              
72             sub add_path : method {
73 0     0 1   my($self, $path) = @_;
74              
75 0 0         unlink($path) or dief("cannot unlink(%s): %s", $path, $!);
76 0           return("");
77             }
78              
79             #
80             # troublesome methods (they should not be used)
81             #
82              
83             sub touch : method {
84 0     0 1   dief("unsupported method: touch()");
85             }
86              
87             sub lock : method { ## no critic 'ProhibitBuiltinHomonyms'
88 0     0 1   dief("unsupported method: lock()");
89             }
90              
91             sub unlock : method {
92 0     0 1   dief("unsupported method: unlock()");
93             }
94              
95             sub remove : method {
96 0     0 1   dief("unsupported method: remove()");
97             }
98              
99             sub get : method {
100 0     0 1   dief("unsupported method: get()");
101             }
102              
103             sub get_ref : method {
104 0     0 1   dief("unsupported method: get_ref()");
105             }
106              
107             sub get_path : method {
108 0     0 1   dief("unsupported method: get_path()");
109             }
110              
111             1;
112              
113             __END__