Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl warnings when mouth has no source #2467

Open
xworld21 opened this issue Jan 1, 2025 · 2 comments
Open

perl warnings when mouth has no source #2467

xworld21 opened this issue Jan 1, 2025 · 2 comments

Comments

@xworld21
Copy link
Contributor

xworld21 commented Jan 1, 2025

On occasion, the mouth does not have a defined source, so this call

$STATE->getStomach->getGullet->getMouth->getSource,

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

#$options{source} = "Anonymous String" unless defined $options{source};

but empty strings would do that just fine.

@dginev
Copy link
Collaborator

dginev commented Jan 8, 2025

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.

@xworld21
Copy link
Contributor Author

xworld21 commented Jan 8, 2025

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants