Randal is of course right.  I apologize for my extremely confusing
and idiom riddled post.

"Randal L. Schwartz" wrote:

> >>>>> "David" == David Labatte <[EMAIL PROTECTED]> writes:
>
> David> The why though is most likely that: undef ne ''
>
> That's not true.  undef eq ''.
>

Sorry I meant that statement in the english phrase sense not in the
literal perl sense.  I'll translate it from garbledslash.psudogeekese and
never use that particularly poor and confusing dialect here again:

undef is undef, '' is ''.  Occasionally perl will care.  Best to treat them
differently until your comfortable with their differences.

Not even close to what I actually said, but it's what I meant. I guess
I was expecting the reader to somehow divine my actual thoughts.


>
> David> What I usually do if I have code that expects an empty string
> David> instead of an undef is append an empty string onto it when I read
> David> the cgi.pm value into it.
>
> David>     $formdata{view_name} = $query->param('view_name') . '';
>
> David> That way undefined form elements have a consistent value and
> David> it's easy to just send them back out to the user if I have to
> David> without mangling them for display.

>
> This is voodoo programming.  You must've had some problem that this
> appeared to solve at some point, but it isn't needed for what you are
> answering here, so I don't know how that can help.
>

Sorry your right, this is bad programming and way beyond the scope of
what was asked in this question and should not have been mentioned.
Since I've badly explained myself already, I'll waste a little more time
and say it's a useful idiom to force the cgi.pm return value to a true ''
so the differences between it and undef don't bite you unexpectedly.
I'll try to be more on topic with my responses from now on.

>
> undef acts for all intents and purposes the same as an empty string.
> If you have warnings on, you'll get messages when you use it as an
> empty string, but you would have got a message on that first
> concatenate as well.

>

Very true, and sorry this post is not very clear, lucid or representative
of what I was thinking.  Not the best of contributions on my part, and
I'm sorry for anyone I've confused. I will improve.  I promise :)

Thank you Randal for being there giving me a standard to improve to.

--
Perl, because 600 billion oysters can't be wrong
   Canadian Consulting Services' pet perl hacker
   David Labatte [EMAIL PROTECTED]



Reply via email to