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   17328 use strict;
  107         191  
  107         4794  
4              
5 107     107   506 use vars qw($VERSION);
  107         158  
  107         5857  
6             $VERSION = '1.367'; # NOTE - Should be #.### (three decimal places)
7              
8 107     107   599 use Carp qw(croak);
  107         149  
  107         19897  
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 11 my $type = shift;
17 1         193 croak "$type is not meant to be used directly";
18             }
19              
20             sub allocate_wheel_id {
21 586     586 1 1740 while (1) {
22 589 100       3576 last unless exists $active_wheel_ids{ ++$current_id };
23             }
24 586         23095 return $active_wheel_ids{$current_id} = $current_id;
25             }
26              
27             sub free_wheel_id {
28 526     526 1 1278 my $id = shift;
29 526         8184 delete $active_wheel_ids{$id};
30             }
31              
32             sub _test_set_wheel_id {
33 3     3   640 $current_id = shift;
34             }
35              
36             1;
37              
38             __END__