Re: Deprecated warnings in Apache::DBI

2000-04-10 Thread Ken Williams

I don't have 5.6 to test this, but isn't the warnings pragma lexical and
not dynamic now?  Which means it's doing the right thing.

Also, it's probably right - shouldn't Apache::DBI be changed?

Perhaps doing "local $^W;" instead of "no warnings qw(deprecated);" will
be a bandaid for you.


[EMAIL PROTECTED] (Paul G. Weiss) wrote:
In my startup.pl I have

BEGIN
{
no warnings qw(deprecated);
use Apache::DBI;
}

yet when starting the server I always see

defined(@array) is deprecated at
/usrl1/home/pweiss/perl-56/lib/site_perl/5.6.0/Apache/DBI.pm line 135.
(Maybe you should just omit the defined()?)


Shouldn't 'no warnings' suppress this?

-P


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum





RE: Deprecated warnings in Apache::DBI

2000-04-10 Thread Paul G. Weiss

Well if it is lexical shouldn't it suppress the warnings
anyhow?  Remember that the 'use' is lexically inside the
BEGIN block where I have the pragma.

From the command line:

perl -wc Apache/DBI.pm

produces the error while

perl -M-warnings=deprecated Apache/DBI.pm

doesn't.

Any in any case:

BEGIN {
no warnings qw(deprecated);
local $^W=0;
use Apache::DBI ();
}

doesn't suppress the error.

-P

-Original Message-
From: Ken Williams [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 10, 2000 8:22 AM
To: Paul G. Weiss
Cc: '[EMAIL PROTECTED]'
Subject: Re: Deprecated warnings in Apache::DBI


I don't have 5.6 to test this, but isn't the warnings pragma lexical and
not dynamic now?  Which means it's doing the right thing.

Also, it's probably right - shouldn't Apache::DBI be changed?

Perhaps doing "local $^W;" instead of "no warnings qw(deprecated);" will
be a bandaid for you.


[EMAIL PROTECTED] (Paul G. Weiss) wrote:
In my startup.pl I have

BEGIN
{
no warnings qw(deprecated);
use Apache::DBI;
}

yet when starting the server I always see

defined(@array) is deprecated at
/usrl1/home/pweiss/perl-56/lib/site_perl/5.6.0/Apache/DBI.pm line 135.
(Maybe you should just omit the defined()?)


Shouldn't 'no warnings' suppress this?

-P


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum




RE: Deprecated warnings in Apache::DBI

2000-04-10 Thread Ken Williams

[EMAIL PROTECTED] (Paul G. Weiss) wrote:
Well if it is lexical shouldn't it suppress the warnings
anyhow?  Remember that the 'use' is lexically inside the
BEGIN block where I have the pragma.

Yeah, but the line producing the warning isn't, and that's what counts for
lexicals.

Any in any case:

BEGIN {
no warnings qw(deprecated);
local $^W=0;
use Apache::DBI ();
}

doesn't suppress the error.

That's kind of surprising.  Someone with 5.6 will probably have to sort this
out with you, or even better, patch Apache::DBI.  As I said earlier, the
warning is probably right - using defined on aggregates is seldom a good idea,
and that's been true and documented for a really long time.  See perlfunc(1):


   You may also use defined() to check whether a
   subroutine exists.  On the other hand, use of
   defined() upon aggregates (hashes and arrays) is
   not guaranteed to produce intuitive results, and
   should probably be avoided.
   
   ...

   Currently, using defined() on an entire array or
   hash reports whether memory for that aggregate has
   ever been allocated.  So an array you set to the
   empty list appears undefined initially, and one
   that once was full and that you then set to the
   empty list still appears defined.
   
   ...

   This counterintuitive behaviour of defined() on
   aggregates may be changed, fixed, or broken in a
   future release of Perl.


  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum