sylph001 has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
Recently I tried to find a way to display the name of the perl package that the program is in, however didn't get any clue about this.
Could you let me know if there is any special varaible or any other method that I can get the package name?
Thanks a lot in advance
For example, I'm writing a package in "MyModule.pm", and I need to display the package name when the program is executing this package, like in below:
package MyPackage; use warnings; my $pkg_name = <how to know the package name?>; print "I'm currently in the $pkg_name package!"; exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to display name of current package
by LanX (Saint) on Aug 22, 2016 at 10:19 UTC | |
|
Re: How to display name of current package
by Discipulus (Canon) on Aug 22, 2016 at 10:38 UTC | |
by Your Mother (Archbishop) on Aug 22, 2016 at 13:56 UTC | |
by TomDLux (Vicar) on Aug 23, 2016 at 16:04 UTC | |
|
Re: How to display name of current package
by Athanasius (Archbishop) on Aug 22, 2016 at 12:25 UTC |