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

Fast exit undef/empty strings in Data::Dumper::qquote() #22070

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

DabeDotCom
Copy link
Contributor

This silences a squajillion (okay, five) "uninitialized" warnings, and is more efficient, anyway...

This silences a squajillion (okay, five) "uninitialized" warnings,
and is more efficient, anyway...
@DabeDotCom DabeDotCom force-pushed the dabedotcom/data-dumper-qquote branch from fb08490 to 1d91efe Compare March 8, 2024 22:18
@jkeenan
Copy link
Contributor

jkeenan commented Mar 8, 2024

This silences a squajillion (okay, five) "uninitialized" warnings, and is more efficient, anyway...

Can you provide an example of how you are getting these uninitialized warnings? Thanks.

@tonycoz
Copy link
Contributor

tonycoz commented Mar 11, 2024

I don't see any such warnings in the build, and Data::Dumper itself should never call qquote() with undef that I can see.

@DabeDotCom
Copy link
Contributor Author

Can you provide an example of how you are getting these uninitialized warnings? Thanks.

Sorry, I totally cheated and called it from outside... (Text::Quote mentions taking "inspiration" from Data::Dump, but I figured since Data::Dumper was a core module, I'd just leverage *it* instead.)

prompt% perl -MData::Dumper -E 'say Data::Dumper::qquote()'
Use of uninitialized value $_ in substitution (s///) at /System/Library/Perl/5.34/darwin-thread-multi-2level/Data/Dumper.pm line 764.
Use of uninitialized value in numeric gt (>) at /System/Library/Perl/5.34/darwin-thread-multi-2level/Data/Dumper.pm line 775.
Use of uninitialized value $bytes in numeric gt (>) at /System/Library/Perl/5.34/darwin-thread-multi-2level/Data/Dumper.pm line 775.
Use of uninitialized value $_ in pattern match (m//) at /System/Library/Perl/5.34/darwin-thread-multi-2level/Data/Dumper.pm line 783.
Use of uninitialized value $_ in concatenation (.) or string at /System/Library/Perl/5.34/darwin-thread-multi-2level/Data/Dumper.pm line 783.
""

Anyway, I know it's undocumented, and I'm okay if it breaks, but I figured I'd push my (trivial) optimization back upstream, just in case you were interested. «shrug»

Cheers! :-D

@demerphq
Copy link
Collaborator

demerphq commented Mar 11, 2024 via email

@tonycoz
Copy link
Contributor

tonycoz commented Mar 11, 2024

I think it could use a test or two (simple non-empty string, empty string, undef), otherwise it's good.

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

Successfully merging this pull request may close these issues.

None yet

4 participants