I tried the code below but still it gives error :
use strict;
use warnings;
use Net::Address::IP::Local;
print ReturnIpAddress();
sub ReturnIpAddress
{
my $address;
select STDOUT;
eval{
$address = 'Net::Address::IP::Local'->public ; ## Rece
+iving the current IP ##
};
if ($@)
{
print "$@";
return '192.80.160.16'; ##If No IP address received th
+en return a static IP of order "192....."
}
else
{
return $address;
}
}
error is :
Unable to create UDP socket: A socket operation was attempted to an un
+reachab
network. at C:/Perl/site/lib/Net/Address/IP/Local.pm line 166.