The mktag method of the HTML::Tag class sorts the attributes for no other reason than easy testing - there should be a good comparator function that can deal with the nondeterminism instead. It would be a runtime performance gain at the cost of somewhat more complicated tests.