Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Executing perl code

by SuicideJunkie (Vicar)
on Feb 13, 2013 at 18:53 UTC ( #1018600=note: print w/replies, xml ) Need Help??


in reply to Executing perl code

Just make sure nobody types "format c:" into that configuration script!

A much safer way to go about it is to read the config file and look up the provided command in a hash to make sure it is legit.

my ($cmd, @params) = split ',', <$inputFileHandle>; if (exists $hashOfAllowedCommands{$cmd}) { $worksheet->$hashOfAllowedCommands{$cmd}->(@params) }else{ print "Invalid command ignored in config file at line $.\n"; }

If you still want to play with the dynamite then take a look into eval

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018600]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2016-09-29 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (550 votes). Check out past polls.