File: test.pl.developer

package info (click to toggle)
libnet-interface-perl 1.016-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,252 kB
  • ctags: 478
  • sloc: ansic: 3,397; sh: 2,736; perl: 888; makefile: 3
file content (142 lines) | stat: -rw-r--r-- 2,452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Before `make install' is performed this script should be runnable with
# make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

use Test::More qw(no_plan);
#use diagnostics;

# test 1
BEGIN { use_ok( 'Net::Interface',qw(
	:afs
	:pfs
	:ifs
	_NI_AF_TEST
	mask2cidr
	cidr2mask
	full_inet_ntop
	net_symbols
)); }
my $loaded = 1;
END {print "not ok 1\n" unless $loaded;}

=pod

  my $hvp = dtest Net::Interface();

  foreach (keys %{*{$hvp}}) {
    print "$_\t=> ${*{$hvp}}{$_}\n";
  }

  print 'the GV ',${*{$hvp}},"\n";
  print 'the Ref ',ref $hvp,"\n";

  print "arref ",ref ${*{$hvp}}{array},"\n";
# can be expressed as ${*{$hvp}}{array}->[0] or as below
  print "ARVAL ",*{$hvp}->{array}->[0],"\n";

  use Devel::Peek;
  Dump($hvp);
print "\n\n";
  Dump(${*{$hvp}}{array});

=cut

=pod

use Devel::Peek;
use Data::Dumper;

my @ifaces = interfaces Net::Interface();

foreach my $hvp (@ifaces) {
  Dump($hvp);
  print Dumper($hvp),"\n";
}

=cut

=pod

my $hvp = Net::Interface->interfaces();

my $hvp = Net::Interface->dtest2();

use Devel::Peek;
use Data::Dumper;

  print "HVP\n";

  Dump($hvp);
#  print "\nthe PV ptr\n";
#  print Dump(\${*{$hvp}});
#  print "\nthe PV itself\n";
#  print Dump(${*{$hvp}});
#  print "\nthe HASHref\n";
#  print Dump(\%{*{$hvp}});
#  print "\n";

=cut

=pod

for(0..1000000) {
  print $_,"\n" unless $_ % 1000;
  my $hvp=  interfaces Net::Interface();
# my $hvp = dtest Net::Interface();
}

=cut

=pod

use Devel::Peek;
use Data::Dumper;

my $hvp = new Net::Interface('eth0');

Dump($hvp);
print "\n\n";
print Dumper($hvp),"\n";

=cut

=pod

my @all = Net::Interface->interfaces();

print $all[0]->name,"\n";

my @allnames = "@all";
print @allnames,"\n";

=cut

=pod

use Data::Dumper;
my $sym = net_symbols();
print Dumper($sym);

=cut

#print "\nifr\n"; d_ni_ifreq Net::Interface();

#print "\nlifr\n"; d_ni_lifreq Net::Interface();
#print "\nglifr\n"; gifa_lifreq Net::Interface();

#print "\nin6\n"; d_ni_in6_ifreq Net::Interface();
#print "\ngin6\n"; gifa_in6_ifreq Net::Interface();

#print "\nproc\n"; d_ni_linuxproc Net::Interface();
#print "gproc\n"; gifa_linuxproc Net::Interface();

#print "\nbase\n"; gifaddrs_base Net::Interface();

# put interface name in the parens
Net::Interface::macstuff();