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


in reply to (tye)Re: Stupid question
in thread Stupid question

Posted only to maybe help someone else at some point in time...

Update: It's all about this Carp bug (w/this solution) and modifying global variables ( @ARGV in this case - GetOptions modifies @ARGV ) after they get passed to functions.

Although I agree with this format (but have mostly not gotten in the habit of using it myself), one of my co-workers was doing something similar, and got the following error during a Carp::confess from deep within the code (perl 5.8.8 - and we could not come up with a simple test case):

Bizarre copy of HASH in sassign at ...../Carp/Heavy.pm line 45

Although it seemed to be a completely unrelated part of the code, moving the Getopt::Long::GetOptions() call from inside to outside of Main() fixed the problem, and we got the proper confess with stack trace that we wanted to see. Though I'm sure when something with this much deep magic goes wrong, we've probably only fixed a symptom of the problem :-)