in reply to How to break Class::MakeMethods by using the wrong variable name

To avoid or fix the error, don't call your scalars by the same name as a builtin function that you intend to call.
Two alternatives: use the :method attribute on your method. (Class::MakeMethods should probably be doing this for you anyway.) Then non-method calls will call the builtin operator, not the method sub. Or qualify the non-method call with CORE::.
$ perl -we'sub sleep:method { print "in sleep method" } sleep 5; print + "done"' done $ perl -we'sub sleep { print "in sleep method" } CORE::sleep 5; print +"done"' done
  • Comment on Re: How to break Class::MakeMethods by using the wrong variable name
  • Download Code