in reply to xml::twig attributes
my $twig = XML::Twig->new( twig_handlers => { keep_atts_order => 1, color => \&content_handler, }, pretty_print => 'indented', );
should be
my $twig = XML::Twig->new( twig_handlers => { color => \&content_handler, }, keep_atts_order => 1, pretty_print => 'indented', );
You should have seen that problem if you had indented properly. Boo for bad indenting!
Furthermore, by placing the atts in a hash before passing them to set_atts, you change their order before the module even sees them. Turns out set_atts accepts a list of key=>val pairs as an alternative to a hash ref, so change
$color->set_atts({...});
to
$color->set_atts(...);
I hope this is just for æsthetics. You shouldn't expect attributes to be in a particular order.
|
|---|