[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Handleing Web pages (Without actual installing CPAN)

Posted on 2001-06-05
7
Medium Priority
?
169 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans
Suggested Courses

873 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