File Coverage

blib/lib/POE/Wheel.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 3 3 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package POE::Wheel;
2              
3 107     107   24743 use strict;
  107         138  
  107         3901  
4              
5 107     107   486 use vars qw($VERSION);
  107         155  
  107         4957  
6             $VERSION = '1.365'; # NOTE - Should be #.### (three decimal places)
7              
8 107     107   507 use Carp qw(croak);
  107         126  
  107         16742  
9              
10             # Used to generate unique IDs for wheels. This is static data, shared
11             # by all.
12             my $current_id = 0;
13             my %active_wheel_ids;
14              
15             sub new {
16 1     1 1 9 my $type = shift;
17 1         172 croak "$type is not meant to be used directly";
18             }
19              
20             sub allocate_wheel_id {
21 583     583 1 1785 while (1) {
22 586 100       3559 last unless exists $active_wheel_ids{ ++$current_id };
23             }
24 583         17667 return $active_wheel_ids{$current_id} = $current_id;
25             }
26              
27             sub free_wheel_id {
28 513     513 1 1183 my $id = shift;
29 513         6858 delete $active_wheel_ids{$id};
30             }
31              
32             sub _test_set_wheel_id {
33 3     3   1299 $current_id = shift;
34             }
35              
36             1;
37              
38             __END__