Specifically, if you call ref on a variable which is not a reference, it returns blank, which is what you're seeing.
On Tue, Mar 15, 2016 at 3:19 PM, Tilghman Lesher <[email protected]> wrote: > Is it an email typo or a script typo that you're identifying the > variable internally as $HeadOpen, but the passed variable is > $HeadOpenRef ? > > Using 'use strict;' would identify such a problem very quickly. > > On Tue, Mar 15, 2016 at 3:05 PM, Paul Boniol <[email protected]> wrote: >> Minor correction, I was typing between windows. >> >> On Tue, Mar 15, 2016 at 2:57 PM, Paul Boniol <[email protected]> wrote: >>> >>> It appears to me that the 4th parameter of both calls is \$HeadOpen, yes? >>> >>> >>> my ($Message, $Message2, $Die, $HeadOpenRef, $MySendEmail) = @_; >>> >>> if (ref $HeadOpenRef eq 'SCALAR') { >>> $ErrorString2 = ''; >>> } else { >>> $ErrorString2 = 'Got HeadOpen not scalar reference type: ' . ref >>> $HeadOpen . '.'; >>> } >>> >>> For the first call ref returns SCALAR, so it is a reference to a scalar, >>> as expected $ErrorString2 is empty. >>> >>> In the 2nd call, I get $ErrorString2 = Got HeadOpen not scalar reference >>> type: >>> (Noticed I didn't get the period at the end... Do I need to put parens >>> around the ref call? In any case $HeadOpen should only ever be set to 0 or >>> 1.) >>> >>> >>> On Tue, Mar 15, 2016 at 2:34 PM, Tilghman Lesher <[email protected]> >>> wrote: >>>> >>>> The 4th parameter is \$HeadOpen, not $sth->errstr. >>>> >>>> However, the code that is causing the error is not present, so it's >>>> not clear where the problem lies. >>>> >>>> On Tue, Mar 15, 2016 at 2:25 PM, Paul Boniol <[email protected]> >>>> wrote: >>>> > I'm having a weird Perl problem. Maybe someone can see something I >>>> > don't. >>>> > >>>> > I had to put diagnostic code in. In the problematic call, it says the >>>> > 4th >>>> > parameter is a scalar, not a reference to a scalar...? >>>> > >>>> > Call works fine >>>> > >>>> > PrintError ('ID not found. Please check the ID and try again.', >>>> > $sth->errstr, 1, \$HeadOpen, 0); >>>> > >>>> > >>>> > >>>> > Calls throwing an error >>>> > >>>> > PrintError ('Database error executing statement 1.', $sth->errstr, 1, >>>> > \$HeadOpen, 1); >>>> > >>>> > >>>> > The only difference I can see is the working call $sth->errstr is >>>> > normally >>>> > UNDEF. In the one that throws an error, it normally has a value. That >>>> > shouldn't make a difference though, should it? >>>> > >>>> > >>>> > What am I missing? >>>> > >>>> > >>>> > Paul Boniol >>>> > >>>> > -- >>>> > -- >>>> > You received this message because you are subscribed to the Google >>>> > Groups >>>> > "NLUG" group. >>>> > To post to this group, send email to [email protected] >>>> > To unsubscribe from this group, send email to >>>> > [email protected] >>>> > For more options, visit this group at >>>> > http://groups.google.com/group/nlug-talk?hl=en >>>> > >>>> > --- >>>> > You received this message because you are subscribed to the Google >>>> > Groups >>>> > "NLUG" group. >>>> > To unsubscribe from this group and stop receiving emails from it, send >>>> > an >>>> > email to [email protected]. >>>> > For more options, visit https://groups.google.com/d/optout. >>>> >>>> >>>> >>>> -- >>>> Tilghman >>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "NLUG" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/nlug-talk?hl=en >>>> >>>> --- >>>> You received this message because you are subscribed to the Google Groups >>>> "NLUG" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>> >>> >> >> -- >> -- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nlug-talk?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > > > -- > Tilghman -- Tilghman -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
