Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^2: Update config file parametersby afoken (Chancellor) |
on Jan 07, 2016 at 21:12 UTC ( [id://1152247]=note: print w/replies, xml ) | Need Help?? |
here's an option using Data::Dumper and require Please DON'T use this "solution"! This opens a HUGE vulnerability, simply because require $filename;, use $filename;, do $filename;, and eval $filecontent; all treat the configuration file as executable code. See also Re^2: conf file in Perl syntax, Re^2: Storing state of execution. Or just imagine someone successfully executing echo 'system "/bin/rm -rf /";' >> monkConfig.txt before root executes perl -le 'require "monkConfig.txt";'. Also, use and require load each file only once, unless you start messing with %INC. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|