develooper Front page | perl.perl5.porters | Postings from October 2009 and defined @array

Thread Next
Nicholas Clark
October 24, 2009 04:56
Subject: and defined @array
Message ID:
Is this use of defined @array in 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;


    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

Nicholas Clark

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About