in reply to Re^3: "used only once" warning from Class::Std
in thread "used only once" warning from Class::Std

I wish it were so simple, but I don't think so. In fact, my main program and module both had use strict; and use warnings; originally, as I use them habitually. So much so that initially I had thought the warnings were produced because of them and reported a bug on Config::Std that it was incompatible with use warnings;. It was only later that I realized the warning didn't go away when I removed use strict; and use warnings; from my own code.

None the less, to test your assertion, I changed the main program to:

#!/usr/bin/perl use strict; use warnings; use MyClass; my $obj = MyClass->new();

but still the warning was produced.

Then I changed the module to:

package MyClass; use strict; use warnings; use Class::Std; my $hash_ref = {}; bless $hash_ref, 'MyClass'; sub DEMOLISHx { print "demolishing...\n"; } 1;

And still the warning was produced.

So, after all, the warning wasn't produced because Class::Std uses strict and warnings and my module doesn't.

Other ideas?