It's probably UNIVERSAL::can.
Update: Yep, looks like it. UNIVERSAL is Perl's implicit base class for all objects. can queries whether the object has that method (including via inheritance). It looks like the Net::DNS docs are suggesting to use duck typing here to tell whether the Net::DNS::RR subclass has the address method. An alternative would be to use isa (also from UNIVERSAL) to see if an object is of a certain class (or is one of its subclasses) and therefore supports that class's methods. The thing about that is though that you'd have to test against a whole list of Net::DNS::RR subclasses. As long as all of the subclasses' address methods behave the same, duck typing is safe here, and easier.
In reply to Re: In Net::DNS::RR what is the 'can' method? (updated)
by haukex
in thread In Net::DNS::RR what is the 'can' method?
by Lotus1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |