As mentioned before, companies can claim code that was written as it relates to their business, even if it is in your free time. However, I would be very clear about the modules as they relate to their business.
For example does the module you put on CPAN really relate to their specific industry. You make a screw, it would be hard for them to claim that their Accounting business would depend on the type of screw that you just built, too generic. Maybe if you wrote some accounting type modules, there is business relevance but not something general that anyone in other industries can use as well.
Be polite about it, but make sure that they understand, they cannot lay claim to everything that you wrote just because they say so. Negotiate, but if you leave there really is nothing to prevent you from reimplementing those modules again on your own time as long as they are not trade secrets or patents.