in reply to Warnings not being thrown with DBI

Perl does not complain because there is a hash value whose key is 'id' (it autovivifies when you mention it). DBI doesn't complain because undef (NULL) is a valid thing to send as a parameter to execute.

update : See discussion on autovivification below.

Replies are listed 'Best First'.
Re^2: Warnings not being thrown with DBI
by Anonymous Monk on Sep 11, 2005 at 00:39 UTC

    That's not autovivification. if you print dumper the hash, there is still no id after the execute() call.

Re^2: Warnings not being thrown with DBI
by ikegami (Patriarch) on Sep 11, 2005 at 04:19 UTC

    Nit: It's not autovivified.

    my $href = {}; my $id = $href->{id}; print((%$href ? "not empty" : "empty"), "\n"); __END__ output ====== empty

    Hash entries are never autovified.

      Nit: Never say "never":

      main->execute( $href->{id} ); sub execute { for( @_ ) { die if $_->{none}; } } print keys %$href, $/;

      (prints "id")

      - tye        

        Your example does not disprove what I said. What you wrote simplifies to

        $href->{id}->{none}

        A hash is being auto-vivified and a reference to it is assigned to $href->{id}. %{$href->{id}}, is being auto-vivified, NOT $href->{id}.

        To be fair, I trust that he understood what autovivification is. He might have meant that, the OP's code will never autovivify hash values. His "never" was not your "never".