On Mon, Nov 2, 2009 at 5:36 AM, Shameem Ahamed <shameem.aha...@yahoo.com> wrote:
>
> I think, it is installed successfully.
>
> Please run the below script to make sure that it is installed.
>
> use LWP::Simple;
>
> print "LWP/Simple.pm is installed in   $INC{'LWP/Simple.pm'} \n";
>

$ perl --version
This is perl, v5.8.6 built for darwin-thread-multi-2level
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall

$ cat 1perl.pl
use LWP::Simple;
print "LWP/Simple.pm is installed in   $INC{'LWP/Simple.pm'} \n";


$ perl 1perl.pl
LWP/Simple.pm is installed in   /Library/Perl/5.8.6/LWP/Simple.pm

$

I guess I need to figure out how to use that module now to see if it
works.   Is there another commonly used module that you could
recommend, so that I could test wether I can install a module with
cpan.

Here is my first LWP script:

$cat 1perl.pl
use strict;
use warnings;
use LWP::Simple;

$\ = "\n";

open(INFILE, "data1.txt") or die "...$!";

while (my $line = <INFILE>) {
    my @pieces = split(/;/, $line);
    my $domain = $pieces[0];
    print $domain;

    my $url = "http://$domain/";;
    my $content = get($url);
    print substr($content, 0, 250), "\n";

}


$ cat data1.txt
www.yahoo.com;hello
www.google.com;goodbye

$ perl 1perl.pl
www.yahoo.com
<html>
<head>
<title>Yahoo!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="robots" content="noarchive">
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http:/

www.google.com
<!doctype html><html><head><meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<title>Google</title><script>window.google={kEI:"at7uSqbDJJvQeMrktfYO",
kEXPI:"17259,21516,21766,21930,22107,22526",
kCSIE:"17259,21516,21766,21930,22107

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to