in reply to How do you get an "our" var out of an object?

What you're doing wrong is expecting it to work =].

our declares a variable that lives in the current package. (Well, actually it creates a lexical alias to the package variable, but same difference). In the example you have, you're trying to use 'foo_obj' as the package name, because that's how the 'package::variable' syntax works. Even when you have the object, you need the package name the object is blessed in to to access the variables in the package name.

For example, ref returns the package name and you can fairly easily use that to access package variables, but in general this is considered a bad idea. You can always use class methods as accessors.
  • Comment on Re: How do you get an "our" var out of an object?