in reply to How do I query the package name of an object?

You're looking for ref. It will tell you the package without that extra information that Corion mentions.

(Elementary ... perhaps. Dumb? No way.)

  • Comment on Re: How do I query the package name of an object?

Replies are listed 'Best First'.
Re^2: How do I query the package name of an object?
by nobull (Friar) on Jan 31, 2005 at 08:04 UTC
    Most of the time ref() will do but here is also blessed() in Scalar::Util that does there same as ref() for objects but returns undef for references to unblessed things.

    Condider also if you'd be better off using UNIVERSAL::isa which given an object and a package tells you if the object can be treated as being of the class defined by that package (including any subclasses).