LaTeXML
LaTeXML copied to clipboard
perl warnings when mouth has no source
On occasion, the mouth does not have a defined source, so this call https://github.com/brucemiller/LaTeXML/blob/f82b733eade2c81f24567c349929f2a696cb66cb/lib/LaTeXML/Package.pm#L1625 creates annoying perl warnings about using undefined values in strings.
Quick fix is to patch getSource to return an empty string when not defined. Undefined sources seem intentional, given the commit message 'to make it much easier to programatically acces if a source is anonymous or not' at
https://github.com/brucemiller/LaTeXML/blob/f82b733eade2c81f24567c349929f2a696cb66cb/lib/LaTeXML/Core/Mouth.pm#L58
but empty strings would do that just fine.
This is easy to silence with just adding ->getSource || '' to that Package.pm line.
But are we sure the warnings are meaningless / come in a healthy setting? Some example where they get emitted could be helpful to see if any changes to Mouth itself are necessary.
in a healthy setting
Is raw beamer healthy? Probably not!
It's easier to look at the uses of getSource because there are only two of them. DefMathI uses it for 'introspection' and doesn't distinguish between defined and undefined source. State uses it to check if the file extension is tex or bib. So at the moment there is no reason for having getSource optional string as opposed to always a string.
(Further detail: Mouth->create sets an empty string for literal: and for undefined sources; Mouth->openString leaves the source undefined. The distinction seems accidental.)