use CPAN::Uploader; my $file = 'Dist-0.1.tar.gz'; CPAN::Uploader->upload_file( $file, { user => 'your_cpan_id', password => 'your_cpan_password', }, );