How to Install HTML::Tokeparser or TagParser in XAMPP?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to Install HTML::Tokeparser or TagParser in XAMPP?

Postby PVL » 09. December 2008 21:56

I had XAMPP 1.6.6a, which i upgraded to 1.6.7 and later to 1.6.8. I need to parse HTML and I find that the TokeParser or TagParser can help me with the job. I could not find .PPD file for the same in any website and am not able to install using tar.gz file. System throws error


C:\SWDownloads\TagParser\HTML-TagParser-0.16>perl -MCPAN -e "install HTML::TagPa
rser"
CPAN: Storable loaded ok (v2.16)
Going to read C:\xampp\perl\cpan\Metadata
Database was generated on Mon, 08 Dec 2008 11:26:51 GMT
Running install for module 'HTML::TagParser'
Running make for K/KA/KAWASAKI/HTML-TagParser-0.16.tar.gz
CPAN: Digest::SHA loaded ok (v5.44)
CPAN: Compress::Zlib loaded ok (v1.4201)
Checksum for C:\xampp\perl\cpan\sources\authors\id\K\KA\KAWASAKI\HTML-TagParser-
0.16.tar.gz ok
CPAN: Archive::Tar loaded ok (v0.07)
Will not use Archive::Tar, need 1.00

CPAN.pm needs either the external programs tar, gzip and bzip2
installed. Can't continue.

Can anybody help me on how I can install the above package? I am new to perl and xampp.
PVL
 
Posts: 3
Joined: 09. December 2008 21:50

Re: How to Install HTML::Tokeparser or TagParser in XAMPP?

Postby Sharley » 09. December 2008 23:19

Those 2 modules are installed in the Perl Addon by default - check here:
http://www.apachefriends.org/winxampp/perl-modules.html
The relevant HTML pm files are stored here:
C:\xampp\perl\site\lib\HTML
C:\xampp\perl\lib\HTML

If you downloaded and installed the Perl 5.10.0-2.2.9-pl2 addon then you have only a very limited (NO ActivePerl) instance which will simply not work - been there done that!.

Go to the SourceForge repository and download a full addon version, the latest for XAMPP 1.6.8 is Perl 5.10.0-2.2.9 (note no -pl2 in the name, also note the very small file size in comparison to the full addon file size) - use the zip or the smaller 7zip self extracting exe archive files or if you used the installer version to install XAMPP then use the installer addon version if you prefer.
Simply install by overwriting files when asked and following the install instructions in the readme-addon-perl file to run the setup_xampp.bat file twice - this readme file has the correct installation instructions even though it is the readme file from the useless smaller pl2 addon.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to Install HTML::Tokeparser or TagParser in XAMPP?

Postby PVL » 10. December 2008 18:46

Thank you for the reply. I installed the xampp-win32-perl-addon-5.10.0-2.2.9-installer.exe and thought I have to install xampp-win32-perl-addon-5.10.0-2.2.9-pl1-installer.exe and pl2 also and first installed pl1. But the notes about that showed no ActivePerl and hence after the Pl1 installation, I installed the plain xampp-win32-perl-addon-5.10.0-2.2.9-installer.exe once again.

Now my earlier code is throwing some error which I am unable to decipher and still my installed packages do not show TokeParser or TagParser. There are 299 modules installed and the ones starting with HTML are
HTML-Ajax
HTML-Dojo
HTML-Parser
HTML-Tagset
HTML-Tree

The code which was working earlier is as follows,

use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTML::LinkExtor; # allows you to extract the links off of an HTML page.


&startsub;

sub startsub
{
my $url = "http://www.rediff.com/";

$browser = LWP::UserAgent->new();
$browser->timeout(10);

my $request = HTTP::Request->new(GET => $url);
my $response = $browser->request($request);
if ($response->is_error()) {printf "%s\n", $response->status_line;}
my $contents = $response->content();
print $contents;

my ($page_parser) = HTML::LinkExtor->new(undef, $url);
$page_parser->parse($contents)->eof;
my @links = $page_parser->links;

foreach $link (@links)
{

my $request = HTTP::Request->new(GET => $$link[2]);
my $response = $browser->request($request);
if ($response->is_error()) {printf "%s\n", $response->status_line;}
my $contents = $response->content();

if (length($contents) > 50)
{
print "\n____________________________________________";
print $contents."\n";
print "\n____________________________________________";
}

}
}

Now I am getting error,
501 Errno architecture (MSWin32-x86-multi-thread-4.0) does not match executable architecture (MSWin32-x86-multi-thread-5.00)

I can see the pm files in the folder but they dont appear installed in PPM. Also I am getting the above error. Am I making some mistake in installation?
PVL
 
Posts: 3
Joined: 09. December 2008 21:50

Re: How to Install HTML::Tokeparser or TagParser in XAMPP?

Postby Sharley » 10. December 2008 23:49

PVL wrote:...Now my earlier code is throwing some error which I am unable to decipher and still my installed packages do not show TokeParser or TagParser. There are 299 modules installed and the ones starting with HTML are
HTML-Ajax
HTML-Dojo
HTML-Parser
HTML-Tagset
HTML-Tree...
Go to http://localhost and look for the Perl menu item in the left frame.
After clicking on the link there is now a menu item perlinfo() - click on the link and it should reveal all the modules that are installed on your system.

Also open your httpd.conf file and make sure these lines look like this:
# Perl
Include conf/extra/perl.conf

If it is commented out then remove the comment character # from in front of this line only:
# Include conf/extra/perl.conf
so it looks like this:
Include conf/extra/perl.conf

PVL wrote:The code which was working earlier is as follows,

use LWP::Simple;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use HTML::LinkExtor; # allows you to extract the links off of an HTML page...
I see no shebang line.
There should be a path to perl (shebang) line at the very start of your perl script similar to this:
#!"C:\xampp\perl\bin\perl.exe"
Your path to perl may be different so change the above line to reflect your own path to perl.
Please add it to every perl script you are using.

Where are you running this perl script from and how are you calling it?
A URI in your browser?
The command line?
Etc.

Where have you put the script in your web tree?
In a cgi-bin in the web tree inside the htdocs folder?
In the XAMPP cgi-bin?
Etc.

What is the name or rather the extension of your script?
for example is it scriptname.cgi or scriptname.pl

PVL wrote:Now I am getting error,
501 Errno architecture (MSWin32-x86-multi-thread-4.0) does not match executable architecture (MSWin32-x86-multi-thread-5.00)
I can't find any reference to this error nor any fix so it may be related to what the answers to my above questions are.

PVL wrote:I can see the pm files in the folder but they dont appear installed in PPM...
See the results of perlinfo() above...
...and in PPM
click on menu View and select all packages after the sync has finished loading.
Now select/highlight HTML-TableParser.
Click on menu Action and select Install HTML-TableParser.
Now click on menu File and select Run Marked Actions.
Click OK when the pop up confirmation displays.
Wait until the install is complete and at all times watch the display in the Status tab for info.
Now check the Details tab.
Now check under menu View the Installed Packages again to see the HTML-TableParser is installed.
Repeat the above for anymore packages you feel you need installed.

PVL wrote:Am I making some mistake in installation?
How did you install the addon? Details of how you did this install is the only way I could know if you did anything wrong.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to Install HTML::Tokeparser or TagParser in XAMPP?

Postby PVL » 11. December 2008 01:43

Thanks again for the reply. I used installer version of XAMPP. I checked the perlinfo from the localhost - Perl link and found as you said TokeParser installed. I got the error solved from the post http://community.activestate.com/forum- ... -5-8-8-822 . I just renamed the errno.pm in c:/xampp/perl/site/lib folder and everything started to workagain.

I am using Perlexpress IDE to run these scripts. Also I was using this line on the top #!/usr/bin/perl which I did not copy in my earlier post. Thanks a lot for the timely help. I was feeling terribly lost.
PVL
 
Posts: 3
Joined: 09. December 2008 21:50


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 151 guests