Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by sbasbasba (Initiate)
on Oct 06, 2013 at 16:32 UTC ( #1057165=note: print w/ replies, xml ) Need Help??


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
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1057165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-08-23 15:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (174 votes), past polls