Convert from XML::Simple to XML::LibXML
Short description of changes
This converts the Perl script tools/checkkeys.pl from using the deprecated XML::Simple to using XML::LibXML instead. There are no changes in functionality or behaviour.
CHANGELOG: Tools: update checkkeys.pl to use XML::LibXML
Context: Fixes an issue?
XML::Simple is now deprecated as reported by @pljones on Discord. This is the only tool in the repo that used XML::Simple.
Does this change need documentation? What needs to be documented and how?
No. Internal operation only.
Status of this Pull Request
Ready to merge
What is missing until this pull request can be merged?
Nothing
Checklist
- [x] I've verified that this Pull Request follows the general code principles
- [x] I tested my code and it does what I want
- [x] My code follows the style guide
- [x] I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
- [x] I've filled all the content above
Ran on HEAD of softins/jamulus:perl-xml-libxml
$ ./tools/checkkeys.pl
Possible duplicate hotkeys:
I'm pretty certain that's right!
Not for now but I'll feature request a summary saying "Checked <X> files, found <Y> languages with <Z> hotkeys" then only emit the "Possible duplicate hotkeys:" if there are any. (Of course, it's so long since I wrote any Perl, I'm tempted to use AI to translate it to something else -- bash with yq (which'll do XML) or even python -- and change that...)
Ran on HEAD of softins/jamulus:perl-xml-libxml
$ ./tools/checkkeys.pl Possible duplicate hotkeys:I'm pretty certain that's right!
You need to cd to the translation directory first:
cd src/translations
../../tools/checkkeys.pl
The new version of the tool produces identical output to the old one. The output is simplistic in that it isn't able to take full account of context to know which accelerators actually conflict, and which matches are actually ok because they are in different menus, for example. But overcoming that is a bigger project than just changing XML library.
Not for now but I'll feature request a summary saying "Checked files, found languages with hotkeys" then only emit the "Possible duplicate hotkeys:" if there are any. (Of course, it's so long since I wrote any Perl, I'm tempted to use AI to translate it to something else -- bash with
yq(which'll do XML) or even python -- and change that...)
If rewriting it, it would need to be into Python with nested dicts. But I'm only a beginner with Python, as opposed to being very at home with Perl for 30 years!
You need to cd to the translation directory first:
Things like that could also be changed. Ideally all these checks should be run from the repository root and take care of their own internal requirements. Again, not for this PR.