Link to home
Start Free TrialLog in
Avatar of ronenla
ronenla

asked on

Handleing Web pages (Without actual installing CPAN)

Hi,

I work with unix,
If I understood correctly, To install Cpan modules -
I should be an administrator (and I'm not).

In order to "use Telnet" I took the file Telnet.pm and
Included in @INC the directory that contained the file.
It worked - without installing CPAN.

I'd like to write a perl script that handles web pages.
Perl cookbook offers the use of those modules:
LWP::Simple;    ,   LWP::UserAgent;
URI::URL;         ,   HTTP::Request;
I tied to use: lcwa-1.0.0/ library (took it from cpan.org) but
Without compiling CPAN I get Errors "Can't find func...".

Could you please offer me a solution ?
Either:
a) How to use the *.pm files without installing - so
    It would work (unfortunatly each file uses other files
    using "use" and "require"..... I tried gathering the files
    the modules require in same library, then gave the same
    tree of directories, but it didn't work for me).
Or
b) A way to handle Web pages without CPAN functions
   (a demo script???).
   I'd like to be able to send data & read a page in order
   to analyze the text in the page.

Thanks,
Ronen.
Avatar of shlomoy
shlomoy

you can install CPAN modules and not be a superuser.
You can install them locally.

When you download a CPAN module and you untar/ungzip it you should read the INSTALL and README files to learn how to install it locally for your own use.
If you want to install a private copy of libwww-perl in your home
directory, then you should try to produce the initial Makefile with
something like this command:

  perl Makefile.PL LIB=~/perl
                                     
"If I understood correctly, To install Cpan modules -
I should be an administrator (and I'm not)."

You can correctly install CPAN modules into any directory where you have enough rights to write, (usually somewhere in your home directory). Example:

gzip -cd libwww-perl-5.48.tar.gz | tar xvf -
cd libwww-perl-5.48
perl Makefile.PL LIB=/home/ronenla/perl
make
make install

and then use it like:

#!/usr/bin/perl
use lib '/home/ronenla/perl';
use LWP::UserAgent;
use HTTP::Request;
...


- Sapa

Avatar of ronenla

ASKER

Shlomoy,
I already tried this option:
perl Makefile.PL LIB=~/my_dir
but it didn't work. I got those Errors:
syntax error in file Makefile.PL at line 4, next 2 tokens "use ExtUtils"
syntax error in file Makefile.PL at line 14, next 2 tokens "\MY:"

So I still need:

Either:
Help to locally install CPAN LWP lib
Or:
A demo script how to get a web page and analyze it.

Ronen.

ASKER CERTIFIED SOLUTION
Avatar of Sapa
Sapa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ronenla

ASKER

Shlomoy,
I already tried this option:
perl Makefile.PL LIB=~/my_dir
but it didn't work. I got those Errors:
syntax error in file Makefile.PL at line 4, next 2 tokens "use ExtUtils"
syntax error in file Makefile.PL at line 14, next 2 tokens "\MY:"

So I still need:

Either:
Help to locally install CPAN LWP lib
Or:
A demo script how to get a web page and analyze it.

Ronen.

Avatar of ronenla

ASKER

Shlomoy,
I already tried this option:
perl Makefile.PL LIB=~/my_dir
but it didn't work. I got those Errors:
syntax error in file Makefile.PL at line 4, next 2 tokens "use ExtUtils"
syntax error in file Makefile.PL at line 14, next 2 tokens "\MY:"

So I still need:

Either:
Help to locally install CPAN LWP lib
Or:
A demo script how to get a web page and analyze it.

Ronen.