Saturday, April 11, 2009

Problems with Net::DHCP::Watch on mac...solved

So I got this running, I was having some problems using it.
I had this error:

Can not resolve: 192.168.1.200 at dhcp2.pl line 8
Can't call method "addr_list" on an undefined value at /Library/Perl/5.8.8/Net/DHCP/Watch.pm line 57.

I think it has something to do with the way it was parsing the IP's in both the $Server and $IP, so I solved it by adding these lines to the /etc/hosts...which you will need to sudo for, so sudo vi /etc/hosts, and append:


192.168.1.1 dhcp.local
192.168.1.200 me.local

That is assuming that your IP is 192.168.1.200 and your dhcp server is 192.168.1.1. So just make it look like this in your perl file:


my $Server = "dhcp.local";
# this machine ip and ethernet address
my $IP = "me.local";


I really don't know what the problem was so this is kind of a cluge.

No comments: