Web Hosting Talk







View Full Version : Perl HTML Parser


suracha
06-18-2001, 11:58 AM
dear,

My server is Windows 2000, Active state perl 5.x
I need to use HTML Parser, but it wasn't install on server.

In this case, is there any where to use PPM without install it, just use on my application.

Suracha S.

Chas
06-18-2001, 01:53 PM
PPM should be installed by default. You might want to ask your host to install the module for you. If your host wont install it you can try to put it in a private lib on your server. Download the module(s) from www.cpan.org and place it in a directory on your account. When you want to use that module you can call it like this:

#!/usr/bin/perl
use lib qw(/home/your_account/path/to/lib);
use ModuleName;

I have had to do that on a few *NIX servers and it works for most modules. I always use PPM for NT/2000 servers though. You might want to take a look at the activestate.com website and make sure that the module you want to use is compatible with Window$.

Regards,
Chas

suracha
06-19-2001, 02:21 AM
Thank you.

and is there any way to check that the modules was installed or not.

regards,
Suracha S.

Chas
06-19-2001, 10:25 AM
Try this code:


#!/usr/bin/perl
#
#############################################################
# File Name: modules.cgi
# Written by Widgetz, Jerry, Gossamer Threads Scripts User
# Last Modified: November 08,1999
#############################################################

use strict;
use File::Find;
my (@mod, %done, $dir);
find(\&get, grep { -r and -d } @INC);
@mod = grep(!$done{$_}++, @mod);
foreach $dir (sort { length $b <=> length $a } @INC) {
foreach (@mod) { next if s,^\Q$dir,,; }
}
print "Content-type: text/html\n\n";
print "<ol>";
foreach (@mod) { s,^/(.*)\.pm$,$1,; s,/,::,g; print "<li>$_\n"; }
print "Done! ($#mod modules!)\n\n";
sub get { /^.*\.pm$/ && /$ARGV[0]/i && push @mod, $File::Find::name; }


I copied this from a Gossamer-threads.com forum Click here for the thread (http://www.gossamer-threads.com/perl/forum/showflat.pl?Cat=&Board=PerlCGI&Number=145928&page=0&view=collapsed&sb=5)

I made a couple of changes to format the output a little better. It uses the File::Find module so hopefully that is installed. I think it is a standard module for Activestate perl.

Regards,
Chas

suracha
06-20-2001, 02:37 PM
dear,

thank you very much for your help, everything work fine.

regards,
Suracha S.