in reply to Re^2: How to handle Net::Address::IP::Local'->public when we are not connected to internet
in thread How to handle Net::Address::IP::Local'->public when we are not connected to internet
Try the same with eval. Here is the code, I have added eval part
use strict; use warnings; use Net::Address::IP::Local; print ReturnIpAddress(); sub ReturnIpAddress { 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; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to handle Net::Address::IP::Local'->public when we are not connected to internet
by ppp (Acolyte) on Jan 19, 2015 at 18:11 UTC | |
|
Re^4: How to handle Net::Address::IP::Local'->public when we are not connected to internet
by Anonymous Monk on Jan 19, 2015 at 17:12 UTC | |
by Laurent_R (Canon) on Jan 19, 2015 at 18:59 UTC |