You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Lourdes Herling <lh...@mobydick.inventivecomm.com> on 2000/10/17 18:28:23 UTC

perl warnings

Our logs are filling up with the "use of uninitialized value" warnings. We
get the warning not only in our own code but also in perl modules.  In our
code they seem to appear anywhere any of the Embperl hashes (fdat,
udat,...) are used.  We have put if defined or if !defined to try to
eliminate these warnings.  We still get a few, although not as many as
before. We are also getting a "useless use of a variable in void context"
warning. We have tried to figure out what is causing this to no avail.  
It always occurs on a line where a string is being assigned to a variable
in order to build a mysql query.  We build a where clause prior to the
line and use that in the query.  We have tried both concatenation and
using the variable name of the where clause in the assignment.
For example:
 $query = "select * from table where ".join(' AND ',@whereclause);
OR
$where = join(' AND ',@whereclause); $query = "select * from table where
$where";


 We get the warning with either method. We have also gotten this
error several times: Database handle destroyed without explicit disconnect
at /usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl.pm line 1397.
Does anyone have any ideas how to eliminate the warnings completely or is
our only option to set Apache error logging to critical?


 Lourdes Herling
Inventive Communications 


Re: perl warnings

Posted by Gerald Richter <ri...@ecos.de>.

> Our logs are filling up with the "use of uninitialized value" warnings. We
> get the warning not only in our own code but also in perl modules.  In our
> code they seem to appear anywhere any of the Embperl hashes (fdat,
> udat,...) are used.

Have you any example that show this behaviour (maybe something that I could
try to let it run here)?

>  $query = "select * from table where ".join(' AND ',@whereclause);
> OR
> $where = join(' AND ',@whereclause); $query = "select * from table where
> $where";
>

This should only get a warning any element of @whereclause is undefined.

>
>  We get the warning with either method. We have also gotten this
> error several times: Database handle destroyed without explicit disconnect
> at /usr/lib/perl5/site_perl/5.005/i386-linux/HTML/Embperl.pm line 1397.

This is issued by DBI if a database handle goes out of scope and you don't
have called disconnect before. The cleanup of Embperl undef's the database
handle in your page and will therefor trigger this warning. Either call
$dbh -> disconnect at the end of your page or use Apache::DBI to keep your
database handle open.

> Does anyone have any ideas how to eliminate the warnings completely or is
> our only option to set Apache error logging to critical?
>

You could set PerlWarn to off (if you are running under mod_perl). I normaly
have it on on my developement machine and off on the production server.

Gerald


>
>  Lourdes Herling
> Inventive Communications
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>
>



-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------