Quite short version:
Almost every perl module has a set of test scripts that can usually be called up by running make test. This happens by default when installing something with CPAN.pm. The output of this can be captured by CPAN.pm and sent on to a receiving server. Said server can be anything, but in almost all cases is the cpantesters metabase server, which integrates the result into a database which contains and summarizes the results of tests for libraries, by library version, operating system and perl version. In addition to people configuring their CPAN.pm that way and sending reports for everything installed, there are also many people who have set up servers that work on testing the newest version of every library uploaded to CPAN.