line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 1997,2002 Spider Boardman. |
2
|
|
|
|
|
|
|
# All rights reserved. |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Automatic licensing for this software is available. This software |
5
|
|
|
|
|
|
|
# can be copied and used under the terms of the GNU Public License, |
6
|
|
|
|
|
|
|
# version 1 or (at your option) any later version, or under the |
7
|
|
|
|
|
|
|
# terms of the Artistic license. Both of these can be found with |
8
|
|
|
|
|
|
|
# the Perl distribution, which this software is intended to augment. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
11
|
|
|
|
|
|
|
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
12
|
|
|
|
|
|
|
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# rcsid: "@(#) $Id: Server.dat,v 1.16 2002/03/30 10:11:24 spider Exp $" |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package Net::UNIX::Server; |
17
|
1
|
|
|
1
|
|
20567
|
use 5.004_04; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
43
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
20
|
|
|
|
|
|
|
#use Carp; |
21
|
0
|
|
|
0
|
0
|
0
|
sub carp { require Carp; goto &Carp::carp; } |
|
0
|
|
|
|
|
0
|
|
22
|
0
|
|
|
0
|
0
|
0
|
sub croak { require Carp; goto &Carp::croak; } |
|
0
|
|
|
|
|
0
|
|
23
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
99
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
BEGIN { |
26
|
1
|
|
|
1
|
|
2
|
$VERSION = '1.0'; |
27
|
1
|
|
|
0
|
1
|
76
|
eval "sub Version { __PACKAGE__ . ' v$VERSION' }"; |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#use AutoLoader; # someday add back, along with AUTOLOAD, below |
31
|
|
|
|
|
|
|
#use Exporter (); |
32
|
1
|
|
|
1
|
|
828
|
use Net::UNIX 1.0; |
|
1
|
|
|
|
|
40
|
|
|
1
|
|
|
|
|
81
|
|
33
|
1
|
|
|
1
|
|
11
|
use Net::Gen 1.0 qw(/^SOCK_/); |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
369
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
BEGIN { |
36
|
1
|
|
|
1
|
|
23
|
@ISA = 'Net::UNIX'; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Items to export into callers namespace by default. |
39
|
|
|
|
|
|
|
# (Move infrequently used names to @EXPORT_OK below.) |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
4
|
@EXPORT = qw( |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
3
|
@EXPORT_OK = qw( |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
553
|
%EXPORT_TAGS = ( |
48
|
|
|
|
|
|
|
ALL => [@EXPORT, @EXPORT_OK], |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
# *AUTOLOAD = \$Net::Gen::AUTOLOAD; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# sub AUTOLOAD inherited from Net::Gen |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# since 5.003_96 will break simple subroutines with inherited autoload, cheat |
56
|
|
|
|
|
|
|
#sub AUTOLOAD |
57
|
|
|
|
|
|
|
#{ |
58
|
|
|
|
|
|
|
# #$Net::Gen::AUTOLOAD = $AUTOLOAD; |
59
|
|
|
|
|
|
|
# goto &Net::Gen::AUTOLOAD; |
60
|
|
|
|
|
|
|
#} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Preloaded methods go here. Autoload methods go after __END__, and are |
64
|
|
|
|
|
|
|
# processed by the autosplit program. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Can't autoload new & init when Net::Gen has them non-autoloaded. Feh. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# No additional sockopts for UNIX-domain sockets (?) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub new : locked |
71
|
|
|
|
|
|
|
{ |
72
|
3
|
|
|
3
|
1
|
9078
|
my $whoami = $_[0]->_trace(\@_,1); |
73
|
3
|
|
|
|
|
11
|
my($class,@Args,$self) = @_; |
74
|
3
|
|
|
|
|
23
|
$self = $class->SUPER::new(@Args); |
75
|
3
|
100
|
|
|
|
11
|
$class = ref $class if ref $class; |
76
|
3
|
50
|
33
|
|
|
32
|
($self || $class)->_trace(\@_,2," self" . |
77
|
|
|
|
|
|
|
(defined $self ? "=$self" : " undefined") . |
78
|
|
|
|
|
|
|
" after sub-new"); |
79
|
3
|
50
|
|
|
|
8
|
if ($self) { |
80
|
3
|
|
|
|
|
15
|
$self->setparams({reuseaddr => 1}, -1); |
81
|
3
|
50
|
|
|
|
11
|
if ($class eq __PACKAGE__) { |
82
|
3
|
50
|
|
|
|
13
|
unless ($self->init(@Args)) { |
83
|
0
|
|
|
|
|
0
|
local $!; # preserve errno |
84
|
0
|
|
|
|
|
0
|
undef $self; # against the side-effects of this |
85
|
0
|
|
|
|
|
0
|
undef $self; # another statement needed for unwinding |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
3
|
50
|
33
|
|
|
29
|
($self || $class)->_trace(0,1," returning " . |
90
|
|
|
|
|
|
|
(defined $self ? "self=$self" : "undefined")); |
91
|
3
|
|
|
|
|
49
|
$self; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#& init($self [, $thispath][, \%params]) : {$self | undef} |
95
|
|
|
|
|
|
|
sub init |
96
|
|
|
|
|
|
|
{ |
97
|
3
|
|
|
3
|
1
|
7
|
my ($self,@args) = @_; |
98
|
3
|
50
|
|
|
|
32
|
return undef unless $self->_init('thispath',@args); |
99
|
3
|
100
|
|
|
|
13
|
if ($self->isbound) { |
100
|
|
|
|
|
|
|
return undef |
101
|
2
|
50
|
66
|
|
|
10
|
unless $self->getparam('type') == SOCK_DGRAM or |
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
102
|
|
|
|
|
|
|
$self->isconnected or $self->didlisten or $self->listen; |
103
|
|
|
|
|
|
|
} |
104
|
3
|
|
|
|
|
21
|
$self; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
1; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# autoloaded methods go after the END token (& pod) below |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |