File Coverage

blib/lib/Queue/Mmap.pm
Criterion Covered Total %
statement 16 21 76.1
branch 3 8 37.5
condition 2 4 50.0
subroutine 3 3 100.0
pod 1 1 100.0
total 25 37 67.5


line stmt bran cond sub pod time code
1             package Queue::Mmap;
2 1     1   36237 use strict;
  1         3  
  1         772  
3 1     1   7 use warnings;
  1         2  
  1         283  
4              
5             our $VERSION = '0.11';
6              
7             require XSLoader;
8             XSLoader::load('Queue::Mmap', $VERSION);
9              
10             sub new {
11 1     1 1 101 my $class = shift;
12 1         3 my %p;
13 1 50       6 unless(@_ % 2){
    0          
14 1         7 %p = @_;
15             }elsif(UNIVERSAL::isa($_[0],"HASH")){
16 0         0 %p = %{$_[0]};
  0         0  
17             }else{
18 0         0 die "bad params"
19             }
20 1 50       5 unless($p{file}){
21 0         0 die "need filename";
22             }
23 1   50     5 $p{queue} ||= 100;
24 1   50     4 $p{length} ||= 100;
25 1         370 my $self = $class->create(@p{'file','queue','length'});
26              
27 1 50       7 if($p{mode}){
28 0         0 chmod $p{mode},$p{file};
29             }
30 1         6 return $self;
31             }
32              
33             1;
34             __END__