I don't see anything obviously wrong with your code. There must be some kind of error message from the compile. You may be missing it because of the configuration of your environment.
(FYI, the debugger can only debug code that compiles correctly. You probably knew that though.)
Incidentally, there are about 50 modules on CPAN that do this.