blib/lib/Sys/Hostname/FQDN.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 100% 4 / 4 totaltotal 91.8% 34 / 37 CC 2 SCAR 2.9
CC
2
Cov
96%
gethostinfo
2.0
asciihostinfo
2.0
BEGIN
1.0
CRAP 1.3
↑ Summary FQDN.xs »
1 package Sys::Hostname::FQDN;
2  
3 #use 5.006;
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 #use warnings;
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use vars qw($VERSION @ISA @EXPORT_OK);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 $VERSION = do { my @r = (q$Revision: 0.12 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
11  
12 2 require Exporter;
13 2 require DynaLoader;
14 #use AutoLoader;
15  
16 2 @ISA = qw(Exporter DynaLoader);
17  
18 2 @EXPORT_OK = qw (
19 asciihostinfo
20 gethostinfo
21 inet_ntoa
22 inet_aton
23 fqdn
24 short
25 );
26  
27 2 bootstrap Sys::Hostname::FQDN $VERSION;
28  
29 # Preloaded methods go here.
30  
31 0 ▶sub DESTROY {};
Subroutine DESTROY: not called CC=1 SCAR=0.0
32  
33 # Autoload methods go after =cut, and are processed by the autosplit program.
34  
35 1 ▶sub short {
Subroutine short: called CC=1 SCAR=0.0
Pod documented
36 1 return (split(/\./,&usually_short))[0];
37 }
38  
39 1 ▶sub fqdn {
Subroutine fqdn: called CC=1 SCAR=0.0
Pod documented
40 1 return (gethostbyname(&usually_short))[0];
41 }
42  
43 0 ▶sub gethostinfo {
Subroutine gethostinfo: not called CC=1 SCAR=6.9
Pod documented
44 0 return gethostbyname(&usually_short);
45 }
46  
47 1 ▶sub asciihostinfo {
Subroutine asciihostinfo: called CC=2 SCAR=6.9
Pod documented
48 1 my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyname(&usually_short);
49 1 for(0..$#addrs) {
50 1 $addrs[$_] = inet_ntoa($addrs[$_]);
51 }
52 1 return ($name,$aliases,$addrtype,$length,@addrs);
53 }
54  
55 =head1 NAME
56  
57 Sys::Hostname::FQDN - Get the short or long hostname
58  
59 =cut
60  
61 2 1;
62 __END__
↑ Summary FQDN.xs »