View Single Post
Old 7th February 2014
thirdm thirdm is offline
Spam Deminer
 
Join Date: May 2009
Posts: 248
Default

Quote:
Originally Posted by J65nko View Post
A summary of their explanation:

$age{'Unborn'} fails the truth test because the number 0 is one of Perl's false values.

$age{'Phantasm'} only exists because it has been given a value in the hash. Because that value is 'undef' it does not pass the test for definedness.
'undef' is also a Perl false value.
And I'm saying that the pkg-config test's purpose is to look for toddlers to put in the pkg-path. That is, it spells out defined and not equal to blank (and also zero, so you can't put in a path of zero -- can't see that as a realistic need though) but if you view the cookbook example as a kind of truth table you can see that the defined test is redundant. It's only necessary to see if $ENV{VAR} is true before using it since not existing and existing as undef both evaluate to false.
Reply With Quote