You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by lporcano <lp...@optonline.net> on 1999/11/07 13:23:49 UTC
Re: Apache::Registry() and strict
It looks like you are trying to determine if an array is empty, in that case
replace
if (!defined(@fields))
with
if (!scalar(@fields)).
----- Original Message -----
From: Ron Rademaker <ro...@wep10a-1.wep.tudelft.nl>
To: <Si...@williamslea.com>
Cc: <mo...@apache.org>
Sent: Tuesday, November 07, 2000 5:26 AM
Subject: Re: Apache::Registry() and strict
> Okay, here's the part where it's going wrong:
>
> my @fields; # The variable that's causing the trouble, should be
> undefined after this declaration
> my $printedfields = 0;
>
> foreach my $hash_ref (@$data_ref)
> {
> if (!defined(@fields)) # Passes the second time the child gets a
> request, but @fields = ()
> {
> @fields = @$hash_ref;
> }
> else
> {
> print "<tr>";
> if (!$printedfields)
> {
> $printedfields = 1;
> foreach my $field (@fields)
> {
> print "<th>$$hash_ref{$field}</th>";
> }
> print "</tr>";
> }
> else
> {
> foreach my $found (@fields)
> {
> print "<td align='center'>";
> my $tempfound = $found;
> my $unitskey = $tempfound . "units";
> my $printed = 0;
> if (defined($$hash_ref{$unitskey}))
> {
> print "$$hash_ref{$unitskey}$$hash_ref{$found}";
> $printed = 1;
> }
> $tempfound =~ s/min//;
> $tempfound =~ s/max//;
> $unitskey = $tempfound . "units";
> if (defined($$hash_ref{$unitskey}) && !$printed)
> {
> print "$$hash_ref{$found} $$hash_ref{$unitskey}";
> }
> elsif(!$printed)
> {
> print "$$hash_ref{$found}";
> }
> print "</td>";
> }
> print "</tr>";
> print "<tr></tr><tr></tr><tr><td
> colspan='$#fields'>$$hash_ref{productlongdescription}</td></tr>" if
> (($url_ref eq "") && (defined($$hash_ref{productlongdescription})) &&
> ($specdb eq ""));
> print "<tr><td colspan='$#fields' align='center'><a
>
href='/cgi-bin/order.cgi?productcode=$$hash_ref{productcode}&number=1'>Beste
l
> dit product</a></td></tr>"; # Second run causes a use of unititialised
> value here, will be solved if defined checks does what is should
> }
> }
> }
>
> On Tue, 7 Nov 2000 Simon_Wilcox@williamslea.com wrote:
>
> >
> > Then it is definitely variable persistence !
> >
> > If you really can't track down the bug, you might try posting your
code to
> > the list.
> >
> > Perhaps someone will spot something you've missed ?
> >
> > Simon.
> >
> >
> >
> >
> >
> >
> > From Ron Rademaker
<ro...@wep10a-1.wep.tudelft.nl>
> > Date 7 November 2000
> >
> >
> > To
> > Simon Wilcox/BASE/WilliamsLea@WilliamsLea Time 10:04
> >
> >
> >
> > Copy to modperl@apache.org
> >
> >
> >
> > Bcc
> >
> >
> >
> > Fax to
> >
> >
> >
> > Subject Re: Apache::Registry() and strict
> >
> >
> >
> >
> >
> > I just read that part of the guide, for the third time today, but still
I
> > didn't see anything that could help, I don't get any warnings and I'm
not
> > using globals. The problem does occur when trying to use a child more
then
> > once. So when I tried running with httpd -X I got the wrong output the
> > second time.
> >
> > Ron
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ______________________________________________________________________
> >
> >
> > This email contains proprietary information some or all of which may
be
> > legally privileged. It is for the intended recipient only. If an
addressing
> > or transmission error has misdirected this email, please notify the
author by
> > replying to this email. If you are not the intended recipient you
must not
> > use, disclose, distribute, copy, print, or reply on this email.
> >
> >
>
>
Re: Apache::Registry() and strict
Posted by lporcano <lp...@optonline.net>.
> I'm not quite looking for a workaround, I already got one, I'd like to
> know why it's going wrong.
Re: Apache::Registry() and strict
Posted by Ron Rademaker <ro...@wep10a-1.wep.tudelft.nl>.
I'm not quite looking for a workaround, I already got one, I'd like to
know why it's going wrong.
Ron
On Sun, 7 Nov 1999, lporcano wrote:
> It looks like you are trying to determine if an array is empty, in that case
> replace
> if (!defined(@fields))
> with
> if (!scalar(@fields)).
>
> ----- Original Message -----
> From: Ron Rademaker <ro...@wep10a-1.wep.tudelft.nl>
> To: <Si...@williamslea.com>
> Cc: <mo...@apache.org>
> Sent: Tuesday, November 07, 2000 5:26 AM
> Subject: Re: Apache::Registry() and strict
>
>
> > Okay, here's the part where it's going wrong:
> >
> > my @fields; # The variable that's causing the trouble, should be
> > undefined after this declaration
> > my $printedfields = 0;
> >
> > foreach my $hash_ref (@$data_ref)
> > {
> > if (!defined(@fields)) # Passes the second time the child gets a
> > request, but @fields = ()
> > {
> > @fields = @$hash_ref;
> > }
> > else
> > {
> > print "<tr>";
> > if (!$printedfields)
> > {
> > $printedfields = 1;
> > foreach my $field (@fields)
> > {
> > print "<th>$$hash_ref{$field}</th>";
> > }
> > print "</tr>";
> > }
> > else
> > {
> > foreach my $found (@fields)
> > {
> > print "<td align='center'>";
> > my $tempfound = $found;
> > my $unitskey = $tempfound . "units";
> > my $printed = 0;
> > if (defined($$hash_ref{$unitskey}))
> > {
> > print "$$hash_ref{$unitskey}$$hash_ref{$found}";
> > $printed = 1;
> > }
> > $tempfound =~ s/min//;
> > $tempfound =~ s/max//;
> > $unitskey = $tempfound . "units";
> > if (defined($$hash_ref{$unitskey}) && !$printed)
> > {
> > print "$$hash_ref{$found} $$hash_ref{$unitskey}";
> > }
> > elsif(!$printed)
> > {
> > print "$$hash_ref{$found}";
> > }
> > print "</td>";
> > }
> > print "</tr>";
> > print "<tr></tr><tr></tr><tr><td
> > colspan='$#fields'>$$hash_ref{productlongdescription}</td></tr>" if
> > (($url_ref eq "") && (defined($$hash_ref{productlongdescription})) &&
> > ($specdb eq ""));
> > print "<tr><td colspan='$#fields' align='center'><a
> >
> href='/cgi-bin/order.cgi?productcode=$$hash_ref{productcode}&number=1'>Beste
> l
> > dit product</a></td></tr>"; # Second run causes a use of unititialised
> > value here, will be solved if defined checks does what is should
> > }
> > }
> > }
> >
> > On Tue, 7 Nov 2000 Simon_Wilcox@williamslea.com wrote:
> >
> > >
> > > Then it is definitely variable persistence !
> > >
> > > If you really can't track down the bug, you might try posting your
> code to
> > > the list.
> > >
> > > Perhaps someone will spot something you've missed ?
> > >
> > > Simon.
> > >
> > >
> > >
> > >
> > >
> > >
> > > From Ron Rademaker
> <ro...@wep10a-1.wep.tudelft.nl>
> > > Date 7 November 2000
> > >
> > >
> > > To
> > > Simon Wilcox/BASE/WilliamsLea@WilliamsLea Time 10:04
> > >
> > >
> > >
> > > Copy to modperl@apache.org
> > >
> > >
> > >
> > > Bcc
> > >
> > >
> > >
> > > Fax to
> > >
> > >
> > >
> > > Subject Re: Apache::Registry() and strict
> > >
> > >
> > >
> > >
> > >
> > > I just read that part of the guide, for the third time today, but still
> I
> > > didn't see anything that could help, I don't get any warnings and I'm
> not
> > > using globals. The problem does occur when trying to use a child more
> then
> > > once. So when I tried running with httpd -X I got the wrong output the
> > > second time.
> > >
> > > Ron
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ______________________________________________________________________
> > >
> > >
> > > This email contains proprietary information some or all of which may
> be
> > > legally privileged. It is for the intended recipient only. If an
> addressing
> > > or transmission error has misdirected this email, please notify the
> author by
> > > replying to this email. If you are not the intended recipient you
> must not
> > > use, disclose, distribute, copy, print, or reply on this email.
> > >
> > >
> >
> >
>