RyanJ has asked for the wisdom of the Perl Monks concerning the following question:
I have a series of dynamic web pages that have (a lot) of common code. I've decided that one way to make sure any updates to said code are propagated across the entire site is to store some of the code inside the database itself.
One of the things that is stored is the HTML header for every page, which, aside from the page name, is the same. The page name itself doesn't change, but is based on another variable stored somewhere else.
I've got the whole header stored in the database, in a LONGTEXT (I believe) type field (I'll verify and post if it's different - I'm not in front of the thing at the moment). There is ALSO a perl variable stored in the header (in the database) - $config{'pagename'} - and when this information gets pulled from the db and printed, it somehow does not get interpreted by perl, and prints EXACTLY as the variable name (without being replaced - e.g. $config{'pagename'}).
I inserted the header information into the appropriate field in the database using phpmyadmin - I copied it directly from working code in my script.
Can anyone direct me as to why it is that I'm getting "escaped" variables in the output? Do I need to escape the variable name BEFORE it goes into the database, so that perl can interpret it properly when it gets read and printed?
ps I'm using the Mysql perl module... perhaps obviously.
pps here's a sample (but not exactly), just to give you the idea of what I'm talking about. The following would be stored in the database field:
<HTML> <HEAD> <title>$config{'pagename'}</title> ... some other header information, such as javascripts ... </HEAD> <BODY>
And when it prints out, the $config{'pagename'} is printed exactly as that without interpretation...
Thanks in advance!
-r-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl variable names stored in mysql fields
by GrandFather (Saint) on Nov 12, 2009 at 20:10 UTC | |
|
Re: Perl variable names stored in mysql fields
by moritz (Cardinal) on Nov 12, 2009 at 19:54 UTC | |
|
Re: Perl variable names stored in mysql fields
by almut (Canon) on Nov 12, 2009 at 19:19 UTC | |
|
Re: Perl variable names stored in mysql fields
by keszler (Priest) on Nov 12, 2009 at 19:21 UTC | |
|
Re: Perl variable names stored in mysql fields
by dwm042 (Priest) on Nov 12, 2009 at 23:31 UTC | |
by RyanJ (Initiate) on Nov 13, 2009 at 00:30 UTC | |
|
Re: Perl variable names stored in mysql fields
by RyanJ (Initiate) on Nov 12, 2009 at 21:15 UTC |