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 108     108   15108 use strict;
  108         122  
  108         3409  
4              
5 108     108   370 use vars qw($VERSION);
  108         144  
  108         4240  
6             $VERSION = '1.366'; # NOTE - Should be #.### (three decimal places)
7              
8 108     108   409 use Carp qw(croak);
  108         112  
  108         15307  
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 12 my $type = shift;
17 1         167 croak "$type is not meant to be used directly";
18             }
19              
20             sub allocate_wheel_id {
21 597     597 1 1351 while (1) {
22 600 100       3055 last unless exists $active_wheel_ids{ ++$current_id };
23             }
24 597         17883 return $active_wheel_ids{$current_id} = $current_id;
25             }
26              
27             sub free_wheel_id {
28 526     526 1 1077 my $id = shift;
29 526         6821 delete $active_wheel_ids{$id};
30             }
31              
32             sub _test_set_wheel_id {
33 3     3   501 $current_id = shift;
34             }
35              
36             1;
37              
38             __END__