karlberry has asked for the wisdom of the Perl Monks concerning the following question:
yields Name "Data::Dumper::Indent" used only once: possible typo. I am not surprised by the warning, require happening at runtime and all; the question is how to get rid of it.use strict; use warnings; require Data::Dumper; local $Data::Dumper::Indent = 0;
Clearly "use vars" and "our" do not help, since they don't take variable names in another module. Specifying "no warnings 'once'" works, but I don't want to turn off these warnings in general, just because I want to set a module's configuration variable.
The only way I have found to avoid the warning is to add some additional null usage, as in:
This does not seem like it should be necessary. I feel like I'm missing something obvious, but I'm failing to discern the answer. Documentation reading and web searches have not been successful. Thanks for any info ...$Data::Dumper::Indent = $Data::Dumper::Indent;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: require and use strict vars
by ikegami (Patriarch) on Dec 02, 2021 at 19:09 UTC | |
|
Re: require and use strict vars
by LanX (Saint) on Dec 02, 2021 at 18:09 UTC | |
by karlberry (Sexton) on Dec 02, 2021 at 18:44 UTC | |
|
Re: require and use strict vars
by Anonymous Monk on Dec 02, 2021 at 19:49 UTC | |
|
Re: require and use strict vars (Data Dumper for DOOP)
by Anonymous Monk on Dec 03, 2021 at 11:07 UTC | |
by ForgotPasswordAgain (Vicar) on Dec 06, 2021 at 19:03 UTC | |
by Anonymous Monk on Dec 06, 2021 at 22:05 UTC |