![]() |
|
Just another Perl shrine | |
PerlMonks |
Tracking down errors in data from input files.by why_bird (Pilgrim) |
on Mar 07, 2008 at 10:38 UTC ( #672731=perlquestion: print w/replies, xml ) | Need Help?? |
why_bird has asked for the wisdom of the Perl Monks concerning the following question: Good Morning Monks, This is a question about error tracking.. Say I'm reading in various variables from various files, and passing them to various different subs in various different modules I wrote. Then say that some of my input data (in the input files) is messed up in some way. So I pass it to one of my subs, and the sub throws an error (lets have an example because I'm confusing myself here :P)
So what I want to be able to do is instead of just printing 'data $variable not valid in mySub' I'd like to be able to print 'data $variable not valid in mySub from line xx in 'main.pl'; line yy in <INPUT>' Is this possible? I thought I could pass $. around but that wouldn't (I don't think) tell me it came from 'main.pl' (And it would be a pain to change all of my subs if there's a simpler way!) I don't even really know where to start on this one, so any monk-ish wisdom would be appreciated! p.s. I wasn't sure what an appropriate title would be so feel free to change it/suggest what it should be changed to Those are my principles. If you don't like them I have others. -- Groucho Marx .......
Back to
Seekers of Perl Wisdom
|
|