blib/lib/POE/Wheel.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 100% 33 / 33 CC 2 SCAR 2.2
CC
2
Cov
100%
allocate_wheel_id
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/POE/Filter/Stream.pm ↑ Summary blib/lib/POE/Pipe/OneWay.pm »
1 package POE::Wheel;
2  
3 110 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 110 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 110 $VERSION = '1.370'; # NOTE - Should be #.### (three decimal places)
7  
8 110 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # Used to generate unique IDs for wheels. This is static data, shared
11 # by all.
12 110 my $current_id = 0;
13 110 my %active_wheel_ids;
14  
15 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
16 1 my $type = shift;
17 1 croak "$type is not meant to be used directly";
18 }
19  
20 609 ▶sub allocate_wheel_id {
Subroutine allocate_wheel_id: called CC=2 SCAR=6.9
Pod documented
21 609 while (1) {
22 612 ▶ last unless exists $active_wheel_ids{ ++$current_id };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $active_wheel_ids{++$current_id} 609 3 612
23 }
24 609 return $active_wheel_ids{$current_id} = $current_id;
25 }
26  
27 527 ▶sub free_wheel_id {
Subroutine free_wheel_id: called CC=1 SCAR=0.0
Pod documented
28 527 my $id = shift;
29 527 delete $active_wheel_ids{$id};
30 }
31  
32 3 ▶sub _test_set_wheel_id {
Subroutine _test_set_wheel_id: called CC=1 SCAR=0.0
33 3 $current_id = shift;
34 }
35  
36 110 1;
37  
38 __END__
« blib/lib/POE/Filter/Stream.pm ↑ Summary blib/lib/POE/Pipe/OneWay.pm »