in reply to CPU Limitation

setpriority will let you set the priority of your script relative to others, though it doesn't set a hard limit. BSD::Resource will let you set a total amount of CPU time a script can be used before it is killed.

There's not an easy way to do this automatically for all scripts in a directory, but you could certainly create a module that set these limits appropriately, then just use that module from any script to which the limits should apply.