nmerriweather has asked for the wisdom of the Perl Monks concerning the following question:
this is quite a dumb, elementary question -- but i can't find the answer
but how do i access the name of the package that the object is?
ie:
package sample; sub new { ... } package main; $a = new sample(); print STDERR $a->NAMEOFPACKAGE;
in the above, i'd like to print "sample", as $a is a sample i know there has to be some attribute that I can't figure out -- and that I don't have to build in an identifier method , I just can't figure it out
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I query the package name of an object?
by Corion (Patriarch) on Jan 30, 2005 at 21:57 UTC | |
|
Re: How do I query the package name of an object?
by Tanktalus (Canon) on Jan 30, 2005 at 22:02 UTC | |
by nobull (Friar) on Jan 31, 2005 at 08:04 UTC | |
|
Re: How do I query the package name of an object?
by Frantz (Monk) on Jan 30, 2005 at 22:01 UTC | |
|
Re: How do I query the package name of an object?
by nmerriweather (Friar) on Jan 30, 2005 at 22:07 UTC | |
|
Re: How do I query the package name of an object?
by borisz (Canon) on Jan 30, 2005 at 22:08 UTC | |
by Tanktalus (Canon) on Jan 30, 2005 at 22:12 UTC | |
by borisz (Canon) on Jan 30, 2005 at 22:16 UTC | |
by Tanktalus (Canon) on Jan 30, 2005 at 22:36 UTC |