| 1 | package Net::DNS::Resolver::UNIX; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 184 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 184 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 92 | our $VERSION = (qw$Id: UNIX.pm 2059 2026-08-28 10:04:18Z willem $)[2]; | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | Net::DNS::Resolver::UNIX - Unix resolver class | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | =cut | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 92 | ▶ | my @config_file = grep { -f $_ && -r $_ } '/etc/resolv.conf'; | ||||||||||||||||||
|
Condition33%1/3
-f $_ && -r $_
MC/DC0%0/2
-f $_ && -r $_
-f $_
-r $_
Truth table33%1/3
A && B
A= -f $_B= -r $_
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 92 | my $homedir = $ENV{HOME}; | |||||||||||||||||||
| 18 | 92 | my $dotfile = '.resolv.conf'; | |||||||||||||||||||
| 19 | 92 | ▶ | my @dotfile = grep { -f $_ && -o $_ } map {"$_/$dotfile"} grep {$_} $homedir, '.'; | ||||||||||||||||||
|
Condition66%2/3
-f $_ && -O $_
MC/DC50%1/2
-f $_ && -O $_
-f $_
-O $_
Truth table66%2/3
A && B
A= -f $_B= -O $_
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 92 | my ($name) = _nosh(qw(uname -n)); | |||||||||||||||||||
| 22 | 92 | chomp $name; | |||||||||||||||||||
| 23 | 92 | my ( undef, @domain ) = split /\./, $name, 2; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 8 | ▶ | sub _init { | ||||||||||||||||||
|
Subroutine
_init: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 27 | 8 | my $defaults = shift->_defaults; | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 8 | $defaults->domain(@domain); | |||||||||||||||||||
| 30 | 8 | $defaults->_read_config_file($_) foreach @config_file; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 8 | %$defaults = Net::DNS::Resolver::Base::_untaint(%$defaults); | |||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 8 | $defaults->_read_config_file($_) foreach @dotfile; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 8 | $defaults->_read_env; | |||||||||||||||||||
| 37 | 8 | return; | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 184 | ▶ | sub _nosh { ## shell-free backtick emulation | ||||||||||||||||||
|
Subroutine
_nosh: called CC=2 SCAR=6.9
| |||||||||||||||||||||
| 41 | 184 | my ( $prog, @arg ) = @_; | |||||||||||||||||||
| 42 | 184 | ▶ | if ( open( my $pipe, '-|' ) ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | 92 | my @retval = ( <$pipe>, '' ); | |||||||||||||||||||
| 44 | 92 | close $pipe; | |||||||||||||||||||
| 45 | 92 | return @retval; | |||||||||||||||||||
| 46 | } else { | ||||||||||||||||||||
| 47 | 92 | local %ENV = ( PATH => '/bin:/usr/bin' ); | |||||||||||||||||||
| 48 | 92 | ▶ | local $SIG{__WARN__} = sub { }; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 49 | 92 | warn 'child process fails without warning'; | |||||||||||||||||||
| 50 | 92 | eval { exec {$prog} $prog, @arg }; | |||||||||||||||||||
| 51 | 0 | exit; ## uncoverable statement | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 92 | 1; | |||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||