Charles K. Clarkson wrote: > Mark Knoop <> wrote: > : Steve Dawson wrote: > : > : : If you're retrieving data from an SQL database, you could see if it > : : supports ISNULL(). It allows you to select an alternate value that > : : will be returned if the requested field is null. Maybe you can use > : : that to avoid your undef... > : > : This was one way to approach it but it still means I have to go > : through and tend to each field in each query individually which > : I feel is not really bomb-proof as I won't know if I've missed > : one until it happens. I wondered whether something like this > : could be set globally? > > Probably not. > > Though I agree with Steve and would probably use SQL to solve > the problem, I can understand your reasoning. There is another > solution that has not been presented. Use a template system which > can handle undefined values. I use HTML::Template, but it is not > limited to HTML. I have used it to customize CSS files and other > templates, for example. > ... > This does two important things. It gets the printed portion of > the script into a separate file, where it can be changed without > mucking up the code. And it gets the programmer out of the "print > it as soon as you produce it" solution mode. Most computers are > amply fast enough that we do not need to print everything > immediately. There is some standard programming approach which > emphasizes this type of output. (MVC, I think.) >
Thanks for this Charles - I think this is the same principle that someone explained to me once in terms of Java servlets about ensuring the layout and the the data are kept completely seperate. I fear that in the short term I can't really justify spending the time on changing everything over to this method but its certainly something I'll look at for future stuff. Cheers Mark _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
