[Templates] undefined warnings

Randal L. Schwartz merlyn@stonehenge.com
07 Oct 2003 10:24:18 -0700


>>>>> "Mark" == Mark Anderson <mda@discerning.com> writes:

Mark> btw, another unfortunate problems in this area is that if you do
Mark> turn on DEBUG=undef, you can't successfully test for being defined
Mark> without dying:

Mark> [% IF (!defined(blah)) %]protected[%END%]

Mark> though you could do something awful like:

Mark> [% DEFAULT blah = 'unusual_value' %]
Mark> [% IF (blah == 'unusual_value')]protected[%END%]

DEFAULT isn't about undef.  It's about false.

[% foo = ''; DEFAULT foo = 'hey'; foo %]

prints "hey".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!