Strict.pm untested

filter: Statementstmt 0.0% 0 / 20 Subroutinesub 0.0% 0 / 4 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # ABSTRACT: NetworkManager strict settings class
2  
3 use v5.37.9;
4 use experimental qw( class builtin try );
5  
6 package NetworkManager::Strict;
7  
8 # @formatter:off
9 class NetworkManager::Strict :isa( NetworkManager::General ) {
10 # @formatter:on
11 use Path::Tiny qw();
12 use System::Command;
13 my %dns = (
14 OpenDNS => [ '208.67.222.123' , '208.67.220.123' ] ,
15 CloudFlare => [ '1.1.1.3' , '1.0.0.3' ] ,
16 );
17  
18  
19 method lock ( $profile = $self -> ethernet ) {
20 my $file = $self -> path -> child( join '.' , $profile , $self -> extension );
21 $file -> chmod( 'a-w' );
22 # Default permissions: -rw------- 1 root root
23 }
24  
25  
26 method set_dns ( $profile = $self -> ethernet , $provider = $dns{OpenDNS} ) {
27 my $command = System::Command -> new( # Debug with: env SYSTEM_COMMAND_TRACE=3
28 'nmcli' , 'connection' ,
29 'modify' , $profile ,
30 'ipv4.dns' , join( ',' , $provider -> @* )
31 );
32  
33  
34 }
35 }
36  
37 __END__