Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Executing perl code

by SuicideJunkie (Priest)
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


Comment on Re: Executing perl code
Download Code

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 about the Monastery: (3)
As of 2014-10-25 05:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls