in reply to both base and sub class in same file
You don't actually need the first 1; line there, before the package Bar; statement, though it's harmless. And number 1 is apperantly special as it doesn't generate useless constant in void warning, as other constants.
I frankly wondered at first, but, fortunately diagnostics has the fact:$ perl -c -we '1' -e syntax OK $ perl -c -we '3' Useless use of a constant in void context at -e line 1. -e syntax OK $ perl -c -we '"OK"' Useless use of a constant in void context at -e line 1. -e syntax OK
This warning will not be issued for numerical constants equal to 0 or 1 since they are often used in statements likeOne more thing, if you really need Foo from Bar, you might consider to use @ISA for inheritance or Exporter for importing Foo's symbols.String constants that would normally evaluate to 0 or 1 are warned about.1 while sub_with_side_effects();
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In Section
Seekers of Perl Wisdom