How do I set CPU limits?

Use the BSD::Resource module from CPAN.