CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Problem with HTML::Strip

 



chander1986
Novice

Apr 2, 2009, 2:20 PM

Post #1 of 12 (3742 views)
Problem with HTML::Strip Can't Post

In my code i am using HTML::Strip, but when i execute the code, i get the following error:

Can't Locate HTML/Strip.pm in @INC.

I dont know how to solve this error. I feel some library file is missing. if its missing then from where can i download it??
The following is the code that i have written


Code
#!/usr/bin/perl 

use IO::File;
use Text::ParseWords;
use HTML::Strip;

$fh = IO::File->new("output_data_all.txt");
$fh_output = IO::File->new("clean_data_all.txt");
$line = $fh->getline;

$hs = HTML::Strip->new();

while(defined $line) {

$clean_text = $hs->parse($line);
$fh_output->print($clean_text);

$line = $fh->getline;
}
$fh->close;
$fh_output->close;



(This post was edited by chander1986 on Apr 2, 2009, 2:23 PM)


KevinR
Veteran


Apr 2, 2009, 2:23 PM

Post #2 of 12 (3740 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post


In Reply To
In my code i am using HTML::Strip, but when i execute the code, i get the following error:

Can't Locate HTML/Strip.pm in @INC.

I dont know how to solve this error. I feel some library file is missing. if its missing then from where can i download it??


You are correct, the module is not installed. Where you download and install it depends on what version of perl you are using but most versions of perl can download from CPAN using the CPAN shell. With activeperl you generally use the PPM application to install modules although you can use the CPAN shell and 'make' if you really wanted to.
-------------------------------------------------


chander1986
Novice

Apr 2, 2009, 2:36 PM

Post #3 of 12 (3738 views)
Re: [KevinR] Problem with HTML::Strip [In reply to] Can't Post

I downloaded the tar.gz file from the net. I unrared it to
c:/Perl/bin

then i went to that folder and followed wat was written in the README file. It said to run the following commands:
perl Makefile.PL
make
make test
make install


When i pressed the first command it said "Writing MakeFile for HTML::Strip" .After that when i typed
"make". It gave me the following error
"'make' is not recognized as an internal or external command,
operable program or batch file."

Where am i going wrong?


KevinR
Veteran


Apr 2, 2009, 2:52 PM

Post #4 of 12 (3736 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post

If you read the Perl Package Manager documentation that comes with your activeperl installation it will explain the process of using PPM or CPAN or manually installing modules. You will need nmake or dmake and possibly a C compiler (unless its a pure perl module). The PPM documentation explains all this in more detail.
-------------------------------------------------


chander1986
Novice

Apr 2, 2009, 7:23 PM

Post #5 of 12 (3729 views)
Re: [KevinR] Problem with HTML::Strip [In reply to] Can't Post

I Didnt understand. Can u refer me to some link which will help me. I m kinda new to PERL.


KevinR
Veteran


Apr 2, 2009, 7:37 PM

Post #6 of 12 (3727 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post

Because you posted 'c:/' I assume you are using Windows and I assume you are using activeperl though you could be using something else. All the documentation for activeperl is installed when you install activeperl. Find the activeperl folder on your hard drive and open it and read the documentation. You will see "Perl Package Manager" mentioned, thats what you want to read. Or go to the activestate website www.activestate.com and find the PPM documentation for your version of activeperl.
-------------------------------------------------


chander1986
Novice

Apr 2, 2009, 8:03 PM

Post #7 of 12 (3724 views)
Re: [KevinR] Problem with HTML::Strip [In reply to] Can't Post

A real thanks a lot Kevin. I read through a document i found online. It asked me to install nmake 1.5. But nmake 1.5 is giving errors. So i wanted to download nmake 7.10, but i couldnt find the location from where i can download this.
And i m not using ActivePerl.


KevinR
Veteran


Apr 2, 2009, 8:37 PM

Post #8 of 12 (3720 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post

What are you using?
-------------------------------------------------


chander1986
Novice

Apr 2, 2009, 9:58 PM

Post #9 of 12 (3716 views)
Re: [KevinR] Problem with HTML::Strip [In reply to] Can't Post

I dont exactly know which perl im using. I just copy pasted a perl folder from my friends pc to my pc. and i keep all my codes in bin folder and run through it.


chander1986
Novice

Apr 2, 2009, 10:39 PM

Post #10 of 12 (3713 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post

hey kevin,
i installed ActivePerl and i read about how to install packages
Another problem im facing is, in the PPM, when i find all the packages, i cant find HTML-STRIP package in it.

The other packages i can see are HTML-Strip-Whitespace
and HTML-StripScripts-Parser. I specifically want HTML-Parser to remove html tags from a file. Will any other package do the work for me?


1arryb
User

Apr 3, 2009, 7:44 AM

Post #11 of 12 (3703 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post

Hi chander,

Having never used ActivePerl, I can't help you with loading new modules. However, you hardly need HTML::Strip to do what you want:

Code
sub strip { 
my $str = shift;
$str =~ tr/\r\n//d; # Remove line termination.
$str =~ s/^\s+|\s+$//g; # Remove leading, trailing whitespace.
return $str;
}

will do nicely.

Cheers,

Larry


KevinR
Veteran


Apr 3, 2009, 9:34 AM

Post #12 of 12 (3699 views)
Re: [chander1986] Problem with HTML::Strip [In reply to] Can't Post


In Reply To
hey kevin,
i installed ActivePerl and i read about how to install packages
Another problem im facing is, in the PPM, when i find all the packages, i cant find HTML-STRIP package in it.

The other packages i can see are HTML-Strip-Whitespace
and HTML-StripScripts-Parser. I specifically want HTML-Parser to remove html tags from a file. Will any other package do the work for me?


In the documentation it should show how to add more PPM repositories and the names of more PPM repositories. Add more repositories, hopefully that module is in one of them.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives