Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Net::Address::Ethernet

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
0
0
DE
Hello,

I tried to find out my MAC using the perl modul Net::Address::Ethernet
(from ActiveState) while running Windows XP.
Therefore I use the following code:

use Net::Address::Ethernet qw( get_address );

my $sAddress = get_address;
my $sMethod = &Net::Address::Ethernet::method;


But how can I get know the MAC ? I used

print ($sAddress);

etc,but...nothing is displayed

Thankx for advice
 
Well, according to the documentation for that module, get_address returns ff:ff:ff:ff:ff:ff (your mac) if called in scalar context or (ff, ff, ff, ff, ff, ff) if called in list context. If you try to print it and don't see anything, you may want to check your $sMethod variable to see what happened. Once again, according to the docs:

After a successful call to get_address(), the method() function will tell you how the information was derived. Currently there are two possibilities: 'arp' for Unix-like systems, or 'ipconfig' for Win32. If you haven't called get_address(), 'N/A' will be returned. If something went wrong during get_address, 'failed' will be returned by method().

Oh, and try reading the manual. :)

Brad Gunsalus
bardley90@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top