| 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 | ▶ | use 5.004_04; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | #use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub carp { require Carp; goto &Carp::carp; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
carp: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub croak { require Carp; goto &Carp::croak; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | $VERSION = '1.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | eval "sub Version { __PACKAGE__ . ' v$VERSION' }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Version: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #use AutoLoader; # someday add back, along with AUTOLOAD, below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | #use Exporter (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use Net::UNIX 1.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use Net::Gen 1.0 qw(/^SOCK_/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | @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 | @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | %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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=25.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | use attrs qw(locked); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | my $whoami = $_[0]->_trace(\@_,1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 | my($class,@Args,$self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | $self = $class->SUPER::new(@Args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | ▶ | ($self || $class)->_trace(\@_,2," self" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self || $class
MC/DC0%0/2
$self || $class
$self
$class
Truth table33%1/3
A || B
A= $selfB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | (defined $self ? "=$self" : " undefined") . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | " after sub-new"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | ▶ | if ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | $self->setparams({reuseaddr => 1}, -1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 3 | ▶ | if ($class eq __PACKAGE__) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | ▶ | unless ($self->init(@Args)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | local $!; # preserve errno | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | undef $self; # against the side-effects of this | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | undef $self; # another statement needed for unwinding | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | ($self || $class)->_trace(0,1," returning " . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self || $class
MC/DC0%0/2
$self || $class
$self
$class
Truth table33%1/3
A || B
A= $selfB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | (defined $self ? "self=$self" : "undefined")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | #& init($self [, $thispath][, \%params]) : {$self | undef} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | sub init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 3 | ▶ | return undef unless $self->_init('thispath',@args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 3 | ▶ | if ($self->isbound) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | ▶ | unless $self->getparam('type') == SOCK_DGRAM or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$self->getparam("type") == 2 or $self->isconnected or $self->didlisten or $self->listen
$self->getparam("type") == 2 or $self->isconnected or $self->didlisten
$self->getparam("type") == 2 or $self->isconnected
MC/DC0%0/4
$self->getparam("type") == 2 or $self->isconnected or $self->didlisten or $self->listen
$self->getparam("type") == 2
$self->isconnected
$self->didlisten
$self->listen
Truth table40%2/5
A or B or C or D
A= $self->getparam("type") == 2B= $self->isconnectedC= $self->didlistenD= $self->listen
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | $self->isconnected or $self->didlisten or $self->listen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # autoloaded methods go after the END token (& pod) below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||