Search code examples
linuxperlmodulecpan

PDF::Create module installation failed using cpan linux command?


When I tried to install cpan module, i get the following error, i have tried by googling it,am unable to find solution.

Catching error: "Can't locate object method \"Create\" via package   \"install PDF\" (perhaps you forgot to load \"install PDF\"?) at /usr/share /perl5/CPAN.pm line 376, <STDIN> line 1.\cJ" at /usr/share/perl5/CPAN.pm line 392, <STDIN> line 1.
CPAN::shell() called at /usr/share/perl5/App/Cpan.pm line 295
App::Cpan::_process_options('App::Cpan') called at /usr/share/perl5/App/Cpan.pm line 364
App::Cpan::run('App::Cpan') called at /usr/bin/cpan line 11

Solution

  • Your error can be reproduced by doing the following:

    $ cpan
    ...
    cpan shell -- CPAN exploration and modules installation (v2.10)
    Enter 'h' for help.
    
    cpan[1]> "install PDF::Create"
    Catching error: "Can't locate object method \"Create\" via package   \"install PDF\" (perhaps you forgot to load \"install PDF\"?) ...
    

    The problem is you putting quotes around the whole command, apparently.

    Solution: Remove the quotes:

    cpan[2]> install PDF::Create
    

    ... works fine here.

    Also, you can just do cpan PDF::Create without entering the cpan shell.