in reply to Redefining Subroutines on the Fly in a Persistent Application
The 'require' is going to end up evaling the source contained in the Sub.pm file anyway, you might as well skip writing to disk and just do the eval yourself.
To get rid of the "subroutine redefined" errors, you might want to try undefining the existing subroutine first (undef &a).