Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: scope and declaration in local packages

by JavaFan (Canon)
on Jan 29, 2011 at 18:11 UTC ( #885050=note: print w/replies, xml ) Need Help??


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().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://885050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2022-05-23 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?