Andy Baugh 3 mesi fa
parent
commit
8680db2c55
2 ha cambiato i file con 26 aggiunte e 22 eliminazioni
  1. 3 1
      Makefile
  2. 23 21
      lib/Net/OpenSSH/More/Linux.pm

+ 3 - 1
Makefile

@@ -3,4 +3,6 @@ test: compilecheck
 
 FILES2CHECK = $(shell find lib/ -name '*.pm')
 compilecheck:
-	$(foreach FILE,$(FILES2CHECK),@perl -Ilib -c $(FILE);)
+	$(foreach FILE,$(FILES2CHECK),perl -Ilib -c $(FILE);)
+
+.PHONY: compilecheck test

+ 23 - 21
lib/Net/OpenSSH/More/Linux.pm

@@ -3,7 +3,7 @@ package Net::OpenSSH::More::Linux;
 use strict;
 use warnings;
 
-use parent 'Net::OpenSSH::More::Linux';
+use parent 'Net::OpenSSH::More';
 
 use File::Slurper ();
 
@@ -11,6 +11,28 @@ use File::Slurper ();
 
 This module assumes that both the local and remote machine are some variant of GNU/Linux.
 
+=cut
+
+###################
+# PRIVATE METHODS #
+###################
+
+my $get_addrs_for_iface = sub {
+    my ( $self, $interface, $proto, $use_local ) = @_;
+    $interface ||= $self->get_primary_adapter($use_local);
+    $self->diag("Attempting to get $proto address for interface $interface");
+    my $regex = $proto eq 'inet' ? '[\d\.]+' : '[\da-f:]+';    # Close enough
+
+    my $cmd     = "ip -f $proto addr show $interface scope global dynamic";
+    my $ip      = $use_local ? `$cmd` : $self->cmd($cmd);
+    my @matches = $ip =~ m/$proto\s+($regex)/g;
+    return @matches;
+};
+
+#######################
+# END PRIVATE METHODS #
+#######################
+
 =head2 METHODS
 
 =head3 B<get_primary_adapter>
@@ -83,24 +105,4 @@ sub get_local_ips {
     );
 }
 
-###################
-# PRIVATE METHODS #
-###################
-
-my $get_addrs_for_iface = sub {
-    my ( $self, $interface, $proto, $use_local ) = @_;
-    $interface ||= $self->get_primary_adapter($use_local);
-    $self->diag("Attempting to get $proto address for interface $interface");
-    my $regex = $proto eq 'inet' ? '[\d\.]+' : '[\da-f:]+';    # Close enough
-
-    my $cmd     = "ip -f $proto addr show $interface scope global dynamic";
-    my $ip      = $use_local ? `$cmd` : $self->cmd($cmd);
-    my @matches = $ip =~ m/$proto\s+($regex)/g;
-    return @matches;
-};
-
-#######################
-# END PRIVATE METHODS #
-#######################
-
 1;