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 110     110   87717 use strict;
  110         176  
  110         3978  
4              
5 110     110   402 use vars qw($VERSION);
  110         156  
  110         5301  
6             $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places)
7              
8 110     110   638 use Carp qw(croak);
  110         313  
  110         19482  
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 138739 my $type = shift;
17 1         144 croak "$type is not meant to be used directly";
18             }
19              
20             sub allocate_wheel_id {
21 609     609 1 2277 while (1) {
22 612 100       5478 last unless exists $active_wheel_ids{ ++$current_id };
23             }
24 609         47401 return $active_wheel_ids{$current_id} = $current_id;
25             }
26              
27             sub free_wheel_id {
28 527     527 1 1232 my $id = shift;
29 527         8459 delete $active_wheel_ids{$id};
30             }
31              
32             sub _test_set_wheel_id {
33 3     3   568 $current_id = shift;
34             }
35              
36             1;
37              
38             __END__