I am not counting on line numbers. The debugged program exited only after evaluating the second line. I also verified it by adding a "die" line between the lines – and then the script dies without the error.
Yossi From: [email protected] [mailto:[email protected]] On Behalf Of sawyer x Sent: Monday, August 01, 2011 6:54 PM To: Perl in Israel Subject: Re: [Israel.pm] Bug in Perl ? (or : what am I missing here ?) Don't count on the exact line numbers. They can seem a bit off. There are various reasons for this and they all make sense once you read up on them. Short answer though: don't think of the line numbers as exact. Your problem is clearly the input, as we've all said. :) Now the question is, how did you reach such input? (it does help though that the error message contains the line number in the faulty input handle) On Mon, Aug 1, 2011 at 5:26 PM, Yossi Itzkovich <[email protected]> wrote: Gabor, Yes, I did try it with perl debugger (line numbers changed from first mail): DB<2> n main::funcMap(./cpp2idl.pl:707): my $retValType=$retVal->{'type'}; DB<2> n main::funcMap(./cpp2idl.pl:708): if ($retValType =~ m/^struct/) main::funcMap(./cpp2idl.pl:709): { DB<2> print $retValType enum eAsonTrailRate DB<3> s Can't use string ("enum eAsonTrailRate") as a HASH ref while "strict refs" in use at ./cpp2idl.pl line 708, <$fh> line 163. at ./cpp2idl.pl line 708 main::funcMap('eAsonTrailRate') called at ./cpp2idl.pl line 416 main::processNewStruct('eAsonTrailRate', 0) called at ./cpp2idl.pl line 366 main::processFile('/auto/enm_proj/XDM_phase_VIII/EMS8.2R3NG/inc/imnmstrailinfo.h') called at ./cpp2idl.pl line 59 IO::Handle::DESTROY(/auto/enm_soft/i86pc/perl/lib/5.8.8/i86pc-solaris/IO/Handle.pm:333): 333: sub DESTROY {} As you can see, the debugger sees $retValType as a simple string, that was set in line 707, but the program exit with error. The strangest thing here, is that line 708 has no de-refencing at all, it is in the previous line that it happened. Yossi Yossi > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Gabor Szabo > Sent: Monday, August 01, 2011 4:54 PM > To: Perl in Israel > Subject: Re: [Israel.pm] Bug in Perl ? (or : what am I missing here ?) > > On Mon, Aug 1, 2011 at 4:03 PM, Yossi Itzkovich > <[email protected]> wrote: > > Hi again, > > > > > > > > Now it looks even weirder : > > > > > > > > my $retValType=$retVal->{'type'}; > > > > if ($retValType =~ m/^struct/) > > > > > > > > and I get the same error (Can't use string ("enum eAsonTrail") as a > HASH ref > > …) on the second line , and not on the first one ! > > > > Line numbers can be off for various reasons. > I don't ask if you ran it through the debugger but have you > tried printing $retVal before the assignment ? > I guess - if this is a loop - you will see several lines like this: > HASH(0x3242) > and then on that contains. "enum eAsonTrail" > > That's a string and not a HASH ref, You will have to track down why do > you > have that sting in $retVal instead of a HASH ref? > > Gabor > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl This e-mail message is intended for the recipient only and contains information which is CONFIDENTIAL and which may be proprietary to ECI Telecom. If you have received this transmission in error, please inform us by e-mail, phone or fax, and then delete the original and all copies thereof. _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl This e-mail message is intended for the recipient only and contains information which is CONFIDENTIAL and which may be proprietary to ECI Telecom. If you have received this transmission in error, please inform us by e-mail, phone or fax, and then delete the original and all copies thereof. _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
