http://qs321.pair.com?node_id=580619

porta has asked for the wisdom of the Perl Monks concerning the following question:

Hi to all. I'm a perl rookie and I started to struggle creating my own modules. I'm having a question that I cannot answer by myself and I ask for your Wisdom to trow some light on my dilemma.
Lets say that I create a module Foo.pm, which has "new" sub.
package Foo; sub new { my ($class) = @_; my $self = {}; bless $self, $class; }
And, I have my script test.pl which has:
use Foo; my $one = Foo->new; my $second = Foo->new;
And my question is: Is there a way that I can, inside Foo.pm, know the name of the variable that I'm using on test.pl?
Lets say I want to create a sub on Foo.pm that just returns the name of $one or $second.
Note that I need this to be able to catch and display my own custom warnings on Foo.pm and I want to give the name of the variable that caused the warning when printing on screen the warning message.
I hope my question is clear enough. I'm not a good english speaker so please excuse any error on the writing. Thanks in advance for any help or comment about this.