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

Hello, I got a package called 1.pm in that the constructor is calling a subroutine which is in the same package. Now if some other classes say 2.pm is calling the constructor defined in 1.pm how can i determine if the subroutine is called from 2.pm ?

Replies are listed 'Best First'.
Re: detemining the calling pakage
by Corion (Patriarch) on Mar 24, 2010 at 08:22 UTC

    caller? But why would you want to know from where you got called?

Re: detemining the calling pakage
by cdarke (Prior) on Mar 24, 2010 at 09:40 UTC
    The first parameter in @_ in the constructor subroutine should be the class name, even if it is called from a derived class.
Re: detemining the calling pakage
by Anonymous Monk on Mar 24, 2010 at 09:33 UTC
    I couldn't understand your question clearly.You explain with sample example.It will be better for me to answer.