http://qs321.pair.com?node_id=885050


in reply to scope and declaration in local packages

On top of what's said above, you're calling sound as a class method, however, the code of the sub suggests it ought to be called as an object method. However, your snippet never creates an object.

Replies are listed 'Best First'.
Re^2: scope and declaration in local packages
by december (Pilgrim) on Jan 31, 2011 at 13:39 UTC

    The code is a lot larger than that. This function however just checks a regex and should work without any instance being in existence, i.e. as a class method. I just wanted to store the regex inside the object so I can check if any input can actually be made into this object without actually trying to create an instance. This one function isn't actually strictly speaking OO at all.

    In pseudo-code, I just want to be able to say: if Dog::looks_like_a_dog, then dog = Dog->make_a_dog().