Quiq/Net.pm

filter: Statementstmt 81.2% 13 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 75.0% 18 / 24 CC 2 SCAR 9.8
CC
2
Cov
72%
checkPort
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Quiq/Zugferd/Entity.pm ↑ Summary Quiq/Range.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Net - Allgemeine Netzwerkfunktionalität
8  
9 =cut
10  
11 # -----------------------------------------------------------------------------
12  
13 package Quiq::Net;
14  
15 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 our $VERSION = '1.240';
20  
21 1 ▶use IO::Socket::INET ();
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 # -----------------------------------------------------------------------------
24  
25 =head1 METHODS
26  
27 =head2 Klassenmethoden
28  
29 =head3 checkPort() - Prüfe, ob Port belegt ist
30  
31 =head4 Synopsis
32  
33 $bool = $class->checkPort($host,$port,@opt);
34  
35 =head4 Arguments
36  
37 =over 4
38  
39 =item $host
40  
41 Name oder IP-Adresse des Host.
42  
43 =item $port
44  
45 Portnummer.
46  
47 =back
48  
49 =head4 Returns
50  
51 Bool
52  
53 =head4 Description
54  
55 Prüfe, ob Port $port auf Host $host belegt, also von einem Prozess
56 geöffnet ist. Falls ja, lefere I<wahr>, andernfalls I<falsch>.
57  
58 =cut
59  
60 # -----------------------------------------------------------------------------
61  
62 0 ▶sub checkPort {
Subroutine checkPort: not called CC=2 SCAR=17.9
Pod documented
63 0 my ($self,$host,$port) = splice @_,0,3;
64  
65 0 my $sock = IO::Socket::INET->new(
66 PeerAddr => $host,
67 PeerPort => $port,
68 Proto => 'tcp', # 'tcp', 'udp', ...
69 Timeout => 10,
70 );
71  
72 0 ▶ return $sock? 1: 0;
Branch: 1 branch
BranchTrueFalseTotal
$sock ? : 0 0 0
73 }
74  
75 # -----------------------------------------------------------------------------
76  
77 =head1 VERSION
78  
79 1.240
80  
81 =head1 AUTHOR
82  
83 Frank Seitz, L<http://fseitz.de/>
84  
85 =head1 COPYRIGHT
86  
87 Copyright (C) 2026 Frank Seitz
88  
89 =head1 LICENSE
90  
91 This code is free software; you can redistribute it and/or modify
92 it under the same terms as Perl itself.
93  
94 =cut
95  
96 # -----------------------------------------------------------------------------
97  
98 1 1;
99  
100 # eof
« Quiq/Zugferd/Entity.pm ↑ Summary Quiq/Range.pm »