All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

I admit it - I've hardcoded sql into my programs before, though I haven't done it in any *major* programs - just short scripts.

What I do now is keep the sql in a separate file, occasionally using a special comment so I can slurp the sql into memory (in paragraph mode) and use the special comment as a hash key (with the sql as the value for that key) so I don't have to remember the order of the sql. e.g.

The other advantage of having the sql separated is that you can do separate version control for that file, and change the sql without having to rerelease the calling script. Probably obvious - just thought I'd mention it for anyone else.:)