I have an assignment in which I am to create a Perl script in Linux to imitate the command ifconfig
. This command basically shows you information about your network interfaces. I have already created the program, but a few lines are giving me some issues, I would appreciate if anyone could correct the code for me. The errors I am getting says that $get_iface_data requires an explicit package name at line 8
, however I do not know how to declare that.
#!/usr/bin/perl
use strict;
use warnings;
use Net::Int::Stats;
use Net::Ifconfig::Wrapper;
my $Iface = $ARGV[0];
my $rx_packets = $get_Iface_data->value($Iface, 'rx_packets');
my $Iface_Info = Net::Ifconfig::Wrapper::Ifconfig('list', '', '', '');
print "\tether ". $Iface_Info->{$Iface}{'ether'}."\n";
My assignment basically requires me to get an interface as input, and display the info about that interface, as the ifconfig
command would do. I also used two packages, Net::Int::Stats
and Net::Ifconfig::Wrapper
. The only difference between my script and the ifconfig
command is my script will require an interface as parameter