The easiest way is to have a module also named CPAN do it for you. This module comes with perl version 5.004 and later.
$ perl -MCPAN -e shell
cpan shell -- CPAN exploration and modules installation (v1.59_54) ReadLine support enabled
cpan> install Some::ModuleTo manually install the CPAN module, or any well-behaved CPAN module for that matter, follow these steps:
Unpack the source into a temporary area.
perl Makefile.PL
make
make test
make install
If your version of perl is compiled without dynamic loading, then you just need to replace step 3 (make) with make perl and you will get a new perl binary with your extension linked in.
See ExtUtils::MakeMaker for more details on building extensions. See also the next question, ``What's the difference between require and use?''.