[guest - Thu Jun 23 14:02:58 2005]:
Show quoted text> I'd love a "sort" option for weighted RRs like MX and SRV. It's pretty
> painful to extract, sort and reassemble a nested array, which is
> why so few implementations do it.
Hi Eric,
I just added an rrsort() function. This is what the changes writes about it:
This was a little tricky as I think that the sort functions are in
fact RR specific class attributes that should be accessed through
class methods. This is difficult to implement. I do think I found a
fairly clean manner. It does require a global variable in Net::DNS
to store the functions and some trickery when the sorting functions
are defined.
See Net::DNS and Net::DNS::RR documentation for details.
Defaults sorting functions are currently implemented in SRV, ..
The code lives on the SVN trunk since about 2 hours and I would appreciate if you would like
to have a look at the documentation you can extract with perldoc from http//www.net-
dns.org/svn/net-dns/trunk/lib/Net/DNS.pm and http//www.net-dns.org/svn/net-dns/
trunk/lib/Net/DNS/RR.pm
If you want to have a look at examples see:http//www.net-dns.org/svn/net-dns/trunk/t/05-
rr-rrsort.t
Sorry it took so long but I wanted to try this in a somewhat generic way and I knew that
would be tricky. I do think we have something useful with the possibility to overwrite the
sorting functions for certain resource record attributes.
The work is not yet finished (I'll have a look at sorting functions for MX and other RRs soon)
but if you have comments or suggestions about improving the interface or documentation
than rather sooner than later :-).
--Olaf