http://www.perlmonks.org?node_id=1057165


in reply to Re: Problem in using Web::Scraper, coming from HTML::TreeBuilder::XPath
in thread Problem in using Web::Scraper, coming from HTML::TreeBuilder::XPath

Hi All,

Thanks for the great answers, and sorry for not having followed the right etiquette of this website. I am not a programmer, and I started using perl only two weeks ago.

So: I have tried to locate where perl is installed: /usr/bin/perl. However, I also see perl5.8.9 and 5.10.0. Furthermore, for some reasons cpan won't let me install modules, so I have basically been copy-pasting the source of the .pm module files I needed, and put them in the relative folders (i.e. HTML/TreeBuilder folder for XPath.pm). Most of these folders, I have no idea why, are located in /System/Library/Perl/Extras/5.10.0/, so that's where I put the files. Both XPath and Scraper are in subfolders of this folder. I know this is not how I should work, but I just couldn't figure out anything better when I started working and only now I realize that I probably made a huge mess.

What would you guys recommend to solve this problem? Where should the folders be located?

Thanks a lot for your precious help!

  • Comment on Re^2: Problem in using Web::Scraper, coming from HTML::TreeBuilder::XPath

Replies are listed 'Best First'.
Re^3: Problem in using Web::Scraper, coming from HTML::TreeBuilder::XPath (cpanm PERL5LIB)
by Anonymous Monk on Oct 06, 2013 at 21:29 UTC

    What would you guys recommend to solve this problem? Where should the folders be located?

    step 1) restore your system perl to the pristine condition that it was ; I can't help with exact steps, its macness :)

    step 2a) maintain your own perl (easy) ( install CitrusPerl), this way you get a newer version of perl, and if apple-macness updates the system perl, you don't have to reinstall/recompile any modules, your perl remains untouched

    step 2b) or maintain your own PERL5LIB with cpanm (like this cpanm --local-lib PERL5LIB export PERL_MB_OPT=--install_base /home/user/devstuff set PERL_MM_OPT=INSTALL_BASE=/home/user/devstuff)

    get cpanm and install Web::Scraper into /home/username/myperllibs

    curl -L http://cpanmin.us | perl - -v --local-lib /home/username/myperllibs App::cpanminus ExtUtils::MakeMaker Module::Build Web::Scraper

    wget -O - http://cpanmin.us | perl - -v --local-lib /home/username/myperllibs App::cpanminus ExtUtils::MakeMaker Module::Build Web::Scraper

    Then you can run perl -I/home/username/myperllibs/lib/perl5/CGI mypythonic.pl or

    export PERL5LIB=/home/username/myperllibs/lib/perl5:$PERL5LIB export PATH=/home/username/myperllibs/bin;$PATH

    perlbrew or perlall are workable alternatives somewhat automating one or more of the above steps

    But when apple-macness updates the system perl, you'll have to recompile/reinstall any modules with binary components(.so/.xs files) not provided by apple-macness (anything with .xs/.sp files in your myperllibs)

    step 3) If you were using a "word processor" switch to a "notepad" equivalent, or a programmers editor ( scite, textpad, gvim, emacs, padre )

      grr, typo (rather obvious but still) -I/home/username/myperllibs/lib/perl5/CGI should be -I/home/username/myperllibs/lib/perl5

      The problem is I have no idea how to restore my Perl. I paid no attention at the beginning when installing modules, and I can't find anything online. I am sure both Web::Scraper and XPath are in the Perl folders under @INC{}; then why why why don't they work???

        I am sure both Web::Scraper and XPath are in the Perl folders under @INC{}; then why why why don't they work???

        It doesn't matter. Install them the way I explained.