I ran into this problem while trying to configure RDBO connections on startup by reading a config file. RDBO has a nasty habit of doing a lot of things during compile time, so the essence boils down to:
#!/usr/bin/perl BEGIN { use Config::Std; read_config "main.conf" => my %config; }
...which runs fine (assuming, you've got a valid main.conf), but warns:
Name "Config::Std::Hash::DEMOLISH" used only once: possible typo at /usr/share/perl5/Class/Std.pm line 523.No problems on execution. It only happens when %config is a lexical though, which I suspect to be part of the problem.
I searched for this, but other than a similar but unrelated warning thrown by LedgerSMB this does not seem to happen to other people. I could just try to make it go away, but I'd rather understand the cause before that.
Any ideas?
Edit: I'll need to clarify.
The main code is nowhere near this snippet. In reality the config is encapsulated into a Moose object that reads the config in its BUILD into an attribute, and will then be instanciated elsewhere, and a long way down the line will be handed to RDBO.
The actual code runs under strict, and the snippet is only for quick reproduction. If you need it even shorter, try:
perl -le 'BEGIN { use Config::Std; read_config "main.conf" => my %config }'Feel free to add strictures and warnings to your liking, it should not change the outcome. What does change the outcome though is a different perl version. 5.8.8 does not give the warning, 5.10.0 and 5.11.0 do. *sigh*
In reply to Config::Std to lexical in BEGIN { } throws warning? by gorash
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |