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

Re: deprecation of defined(%hash)

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
December 9, 2009 09:20
Subject:
Re: deprecation of defined(%hash)
Message ID:
20091209171758.GA16636@klangraum.plasmasturm.org
* Sean <educated_foo@yahoo.com> [2009-12-09 17:45]:
> None of the alternatives I have tried does what I want:

But the right combination would.

>     main @> keys %test::
>     undef
>     main @> %{"test::h"} ? 1 : 0
>     0
>     main @> keys %test::
>     'h'
>     main @> defined %{"test::h2"} ? 1 : 0
>     0
>     main @> keys %test::
>     'h'
>     main @> *{"test::h3"}{HASH} ? 1 : 0
>     0
>     main @> keys %test::
>     h  h3
>     main @> defined *{"test::h4"}{HASH} ? 1 : 0
>     0
>     main @> keys %test::
>     h  h3 h4

    defined ( $test::{'h5'} && *{$test::{'h5'}}{HASH} )

In fact you can leave out the `defined`. The only possible values
are references and undefs anyway.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

Thread Previous | 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