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

Use ref or somewhat complicated:
package sample; sub new { bless {}, shift } package main; my $a = sample->new; use B; print B::class($a);
Boris

Replies are listed 'Best First'.
Re^2: How do I query the package name of an object?
by Tanktalus (Canon) on Jan 30, 2005 at 22:12 UTC

    Update: Remove incorrect reading of Boris' note.

      I just point another way to do it, for fun. I recommend ref for sure. I can not see anything pedantic there. I think you misread my post.
      Boris

        You're probably right - I read your post as saying how you can fool ref to get the wrong answer ... which is possible (I remember a 30+ minute CB conversation detailing ref tricks...), but can break everything else. My apologies.