Solved

Handleing Web pages (Without actual installing CPAN)

Posted on 2001-06-05
7
157 Views
Last Modified: 2010-03-05
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.
0
Comment
Question by:ronenla
  • 3
  • 2
  • 2
7 Comments
 
LVL 8

Expert Comment

by:shlomoy
ID: 6156235
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.
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6156318
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
                                     
0
 
LVL 5

Expert Comment

by:Sapa
ID: 6156321
"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

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ronenla
ID: 6156347
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.

0
 
LVL 5

Accepted Solution

by:
Sapa earned 250 total points
ID: 6156372
ronenla:

it seems like the '~' character was expanded incorrectly. Try my example.

- Sapa
0
 

Author Comment

by:ronenla
ID: 6156375
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.

0
 

Author Comment

by:ronenla
ID: 6156421
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.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now