Keep getting error “Can't locate Image/Grab.pm in @INC” after installing the Perl mod

后端 未结 2 1485
予麋鹿
予麋鹿 2021-01-25 17:51

I\'m a bit new to programming and I\'m having some trouble writing a Perl script that will grab all the images from a webpage and save them in a specified directory.

Her

2条回答
  •  自闭症患者
    2021-01-25 18:05

    That's a standard error when you haven't installed the module. Image::Grab does not come with perl. There are lots of perl modules available on something called cpan, for instance:

    http://search.cpan.org/~mahex/Image-Grab-1.4.2/lib/Image/Grab.pod.

    Modules are libraries of functions that someone has written in perl and made available for your use.

    Now, you have to figure out how to install modules. See if this works:

    $ perl -MCPAN -e shell
    
    -M => Use the module specified, in this case CPAN(comes with perl)  
    -e => execute the following perl code, in this case the function shell().
    

    then

    cpan> install Image::Grab.  
    

    The first time you do that, you'll have to answer a lot of questions.

    Once you are done:

    cpan> q  ('q' is for quit)
    

    Response to comment:

    1) Try updating your CPAN module:

    cpan> install CPAN
    cpan> reload cpan
    

    then:

    cpan> install Image::Grab
    

    Installing from source is fine, but if you can get cpan to work, then it takes care of downloading all the dependencies, so it is hassle free. I just used cpan to download Image::Grab, and I got no errors. It has no dependencies that need to be downloaded.

    2) What is the output of:

    $ perl --version (it looks like you are using perl 5.10.1)  
    

    Also, at the bottom of your question add the entire output from your cpan attempt.

    3) Try installing another module, like:

    http://search.cpan.org/~rehsack/List-MoreUtils-0.402/lib/List/MoreUtils.pm

提交回复
热议问题