in reply to Re: Re: Re: Constant Variables
in thread Constant Variables
Actually, what I want to do, is have all my variables in the column 'name'. They are not yet, PERL strings. I want to make them Perl strings, containing the value in the column 'valu', of the same record id.
For instance, I have these in there so far..
Those are the top few. I want the values in the column 'name' to be Perl Strings, that contain the VALUE in column value.
Like these examples that do NOT work:
If I still did not make it clear what I'm trying to do, please let me know, I'll try to clarify it again ;)
thx,
Richard
For instance, I have these in there so far..
name | valu |
default_font_family | Arial, Helvetica, sans-serif |
default_font_color | #000000 |
standout_text_color | #F52D37 |
disabled_text_color | #C0C0C0 |
Those are the top few. I want the values in the column 'name' to be Perl Strings, that contain the VALUE in column value.
Like these examples that do NOT work:
So now, when I get to a "form" or something, if I know I have the variables in column "name" above, I can put the strings. such as this...$dbh = CWT::Site_DB::connect(); $sth = $dbh->prepare (qq{ SELECT * FROM config_settings }); $sth->execute(); while (my $settings = $sth->fetchrow_hashref()) { use CONSTANT $settings->{name} => $settings->{value}; } $sth->finish(); # OR $dbh = CWT::Site_DB::connect(); $sth = $dbh->prepare (qq{ SELECT * FROM config_settings }); $sth->execute(); while (my $settings = $sth->fetchrow_hashref()) { $$settings->{name} = $settings->{value}; # OR ${$settings->{name}} OR @{$settings->{name}} I've tried a +ll 3, nothing is working. } $sth->finish();
Something like that. The reason they are in a database, instead of just in a file, is that I'm making an admin interface, where they can be editted, easily, by my partners, who do not know perl at all, so they can make changes without having to get into the source code.print qq~Welcome to <font style="font-family: $default_font_family; co +lor: $default_font_color">Company Name</font>~;
If I still did not make it clear what I'm trying to do, please let me know, I'll try to clarify it again ;)
thx,
Richard
In Section
Seekers of Perl Wisdom