[Raleigh-talk] Issues after converting bash to Perl - way to call a config file that contains if/then logic

John Ricker sephtin+pm-talk at gmail.com
Tue Feb 22 07:41:20 PST 2011


Trevor said >  However, I hesitate to even point that out since logic in the
config file is probably a bad idea as was pointed out. If you're hash of all
possible options is not super big (megabytes) I'd just go that route and not
worry about the memory. You may be optimizing prematurely.
Michael said > How many config variables are we talking about? If it's less
than a thousand I doubt you'll event notice the memory usage.

I totally acknowledge that it's probably not a good idea, but it would
simplify things for me a bit..  Hash would as well (copy pasting, instead of
editing a ton of different files)..
The variables are all 8digit hex color codes, there are about 26 vars that
I'm expecting to grab from the config file (in hash scenario, would be 26
members), and currently 19 different possibilities, will be 50 by the end of
the month, and I expect it to grow as themes/ROMs/probably devices are added
later.

This whole thing takes place on a web server (including zipping, running
binaries to zipalig, and decompile some components), where I KNOW I have a
very limited amount of memory (256 with 384 burst, iirc), not to mention
there could be 50 people trying to run this at the same time.. :P  (Maybe
not now.. but in theory).
>From the numbers, the variables are pretty insignificant... ;P

Thanks for the example code Mike, from it I did find what I was doing wrong
last night... and got require working...
And Michael for the article... In my case, this will sit on a webserver and
users will never touch the config file... It's for me.

The script is for android theming...
Currently, I have working a 'require', with 2 files.  one holds info on the
ROM (the stuff on the phone), and one holds info on the theme that the user
selected to apply.  The vars in each are compared, and if they don't match
up, then the file that holds that text is modified and marked for inclusion
(that's essentially how it works, anyway).

I'd have to re-work a good bit of the script if I change over to hash, so
I'll add it to my todo list, but it works well now.  thanks again!

-John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/raleigh-talk/attachments/20110222/b037d10b/attachment.html>


More information about the Raleigh-talk mailing list