There's no need to reverse engineer CPAN. A module called CPAN::Mini provides you with everything needed to host a CPAN repository. Once you have the CPAN repo set up, which takes 5/10 minutes, you can then "inject" your own content into it using CPAN::Mini::Inject.