develooper Front page | perl.perl5.porters | Postings from October 2009

CGI.pm and defined @array

Thread Next
From:
Nicholas Clark
Date:
October 24, 2009 04:56
Subject:
CGI.pm and defined @array
Message ID:
20091024115624.GO60303@plum.flirble.org
Is this use of defined @array in CGI.pm deliberate?

    # if we get called more than once, we want to initialize
    # ourselves from the original query (which may be gone
    # if it was read from STDIN originally.)
    if (defined(@QUERY_PARAM) && !defined($initializer)) {
        for my $name (@QUERY_PARAM) {
            my $val = $QUERY_PARAM{$name}; # always an arrayref;


As in, is it relying on the difference in behaviour between

    scalar @QUERY_PARAM;

and

    undef @QUERY_PARAM;

for the case of

    @QUERY_PARAM = 'Element';
    @QUERY_PARAM = ();

? If so, no comments suggest that this is the intent, and no tests fail if I
change it to remove the defined.


defined @array has been marked as deprecated for aeons, but doesn't (currently)
warn for package variables.

I'd like to change things so that all deprecated features warn, but doing that
in blead right now would make this (and Module::Pluggable, patch sent) issue
warnings.

Nicholas Clark

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About