File Coverage

blib/lib/udp_proxy.pm
Criterion Covered Total %
statement 11 28 39.2
branch n/a
condition 0 3 0.0
subroutine 4 10 40.0
pod 1 3 33.3
total 16 44 36.3


line stmt bran cond sub pod time code
1             package udp_proxy;
2              
3 1     1   21341 use 5.008_008;
  1         5  
4 1     1   7 use strict;
  1         2  
  1         33  
5 1     1   5 use warnings;
  1         6  
  1         30  
6 1     1   796 use POSIX ':signal_h';
  1         8072  
  1         5  
7              
8             require Exporter;
9              
10             our @ISA = qw(Exporter);
11              
12             # Items to export into callers namespace by default. Note: do not export
13             # names by default without a very good reason. Use EXPORT_OK instead.
14             # Do not simply export all your public functions/methods/constants.
15              
16             # This allows declaration use udp_proxy ':all';
17             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
18             # will save memory.
19             our %EXPORT_TAGS = ( 'all' => [ qw(
20            
21             ) ] );
22              
23             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
24              
25             our @EXPORT = qw(
26            
27             );
28              
29             our $VERSION = '0.03';
30              
31             require XSLoader;
32             XSLoader::load( 'udp_proxy', $VERSION );
33              
34             # Preloaded methods go here.
35              
36             sub new {
37 0     0 1   my $invocant = shift;
38 0   0       my $class = ref( $invocant ) || $invocant;
39            
40 0           my( $self ) = constructor( $class, @_ );
41 0           $self->setup_signal_handlers();
42 0           return $self;
43             }
44              
45             sub setup_signal_handlers {
46 0     0 0   my( $self ) = @_;
47              
48 0     0     sigaction SIGINT, new POSIX::SigAction sub { $self->interrupt(); exit; };
  0            
  0            
49 0     0     sigaction SIGQUIT, new POSIX::SigAction sub { $self->interrupt(); exit; };
  0            
  0            
50 0     0     sigaction SIGTERM, new POSIX::SigAction sub { $self->interrupt(); exit; };
  0            
  0            
51             }
52              
53             sub interrupt {
54 0     0 0   my( $self ) = @_;
55              
56 0           $self->interruption();
57             }
58              
59             1;
60             __END__