| 1 | package LCC::UNS; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Make sure we do everything by the book | ||||||||||||||||||||||||||||
| 4 | # Set modules to inherit from | ||||||||||||||||||||||||||||
| 5 | # Set version information | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | @LCC::UNS::ISA = qw(LCC); | |||||||||||||||||||||||||||
| 9 | 1 | $LCC::UNS::VERSION = '0.02'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # Return true value for use | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | 1; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # The following methods are class methods | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # IN: 1 LCC object | ||||||||||||||||||||||||||||
| 22 | # 2 server:port specification | ||||||||||||||||||||||||||||
| 23 | # 3 ref to hash with method/value pairs | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub _new { | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # Obtain the class of the object | ||||||||||||||||||||||||||||
| 28 | # Attempt to create the base object | ||||||||||||||||||||||||||||
| 29 | # Handle the serverport specification if there is any | ||||||||||||||||||||||||||||
| 30 | # Handle any method calls | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
_new: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 33 | 0 | my $self = $class->SUPER::_new( shift ); | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | $self->serverport( shift ) if @_ and !ref($_[0]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and not ref $_[0]
MC/DC0%0/2
@_ and not ref $_[0]
@_
not ref $_[0]
Truth table0%0/3
A and not(B)
A= @_B= not ref $_[0]
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | $self->Set( shift ) if ref($_[0]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # Return the object | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | return $self; | |||||||||||||||||||||||||||
| 40 | } #_new | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # The following methods change the object | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | # IN: new server:port specification | ||||||||||||||||||||||||||||
| 49 | # OUT: current/old server:port specification | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub serverport { shift->_class_variable( 'serverport',@_ ) } #serverport | ||||||||||||||||||||||||||
|
Subroutine
serverport: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | # The following subroutines deal with standard Perl features | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | sub DESTROY { | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | # Obtain the object | ||||||||||||||||||||||||||||
| 62 | # Stop the daemon if so specified | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $self->stop if $self->auto_shutdown; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | } #DESTROY | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | #------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||||||||||