in reply to Re: Creating subroutines on the fly
in thread Creating subroutines on the fly

Dynamic code is also very hard to debug. I would recommend something like the following, to help you find out when/where it has errors.
$code = "print 'Hello World.'"; $sub = eval "sub { $code }"; unless ($sub) { # ack! it failed to eval # lets leave a note about the code, and the error # so we can debug this. die sprintf('CODE: %s\n\nERROR: %s\n\n', $code, $@); }