File Coverage

blib/lib/POE/Wheel/Null.pm
Criterion Covered Total %
statement 9 15 60.0
branch n/a
condition 0 3 0.0
subroutine 3 7 42.8
pod 3 3 100.0
total 15 28 53.5


line stmt bran cond sub pod time code
1             package POE::Wheel::Null;
2              
3             =head1 NAME
4              
5             POE::Wheel::Null - POE Wheel that does put()s data nowhere, and sends nothing.
6              
7             =head1 SYNOPSIS
8              
9             As a primary use whenever you would normally...
10              
11             delete $heap->{wheel};
12              
13             or something equivalent, instead do...
14              
15             $heap->{wheel} = POE::Wheel::Null->new();
16              
17             to prevent calls to $heap->{wheel} from causing runtime errors in perl. This seems to be a Good Idea (tm) when working with long running programs in the traditional POE way.
18              
19             =head1 DESCRIPTION
20              
21             POE::Wheel::Null creates a wheel which doesn't do anything upon put(), and doesn't send any events to the current session.
22              
23             =cut
24              
25 1     1   22550 use strict;
  1         3  
  1         45  
26              
27 1     1   7 use base 'POE::Wheel';
  1         2  
  1         914  
28              
29 1     1   482 use vars '$VERSION';
  1         11  
  1         145  
30             $VERSION = '0.01';
31              
32             =head1 PUBLIC METHODS
33              
34             =over 2
35              
36             =item new
37              
38             The new() method creates a new null wheel.
39              
40             =cut
41              
42             sub new {
43 0     0 1   my $class = shift;
44            
45 0   0       my $self = bless [
46             POE::Wheel::allocate_wheel_id(),
47             ], (ref $class || $class);
48 0           return $self;
49             }
50              
51             =item ID
52              
53             Returns the wheel unique ID
54              
55             =cut
56              
57             sub ID {
58 0     0 1   return $_[0]->[0];
59             }
60              
61             =item put
62              
63             Does nothing (intended)
64              
65             =cut
66              
67 0     0 1   sub put {
68             # NULL OP, MUAHAHAHA!!!
69             }
70              
71             sub DESTROY {
72 0     0     POE::Wheel::free_wheel_id($_[0]->[0]);
73             }
74              
75             =back
76              
77             =head1 EVENTS AND PARAMETERS
78              
79             None
80              
81             =head1 SEE ALSO
82              
83             POE::Wheel, POE
84              
85             =head1 BUGS
86              
87             Roughly zero.
88              
89             =head1 AUTHOR
90              
91             Jonathan Steinert
92             hachi@cpan.org
93              
94             =head1 LICENSE
95              
96             Copyright 2004 Jonathan Steinert (hachi@cpan.org)
97              
98             This program is free software; you can redistribute it
99             and/or modify it under the same terms as Perl itself.
100              
101             =cut
102              
103             1;