Can a function determine what file and line of source in that file called it?

N

Nick Weavers

To assist in debug I would really like my functions to be able to issue a
massage saying exactly where they have been called from.
ie the file name of the calling perl script and the line number in that file
that contains the call.

Does any one know if this is possible and if so could they tell me how, or
point me to the appropriate documentation?

Many thanks,
Nick.
 
T

Tore Aursand

To assist in debug I would really like my functions to be able to issue
a massage saying exactly where they have been called from.

perldoc -f caller


--
Tore Aursand <[email protected]>
"Writing is a lot like sex. At first you do it because you like it.
Then you find yourself doing it for a few close friends and people you
like. But if you're any good at all, you end up doing it for money."
-- Unknown
 
C

ctcgag

Nick Weavers said:
To assist in debug I would really like my functions to be able to issue a
massage saying exactly where they have been called from.
ie the file name of the calling perl script and the line number in that
file that contains the call.

Does any one know if this is possible and if so could they tell me how,
or point me to the appropriate documentation?

In addition to caller, you could "use Carp" to carp, cluck, croak,
or confess.

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,266
Messages
2,571,087
Members
48,773
Latest member
Kaybee

Latest Threads

Top