Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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

Comment on Re: Executing perl code
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2015-10-13 08:44 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (296 votes), past polls