Re: HTML:Parser

2001-01-29 Thread Dave Cross

At Mon, 29 Jan 2001 14:07:27 -, [EMAIL PROTECTED] wrote:

> I've just installed HTML::Parser on a machine here.  It passed all of 
> make, make test and make install fine. (output from make test pasted)

[snip]

> Then when I try to use it in the following file (which is a quick 
> paste from lwpcook, with some changes to make it work in new seperate 
> version of HTML::Parser) 

[snip]

> The output I get from this is
> 
> Can't locate auto/HTML/Parser/traverse.al in @INC (@INC contains the
> followinng paths )
> 
> the paths arse set up correctly and pointing at where I installed the
> module, so I'm stumped.  Does anyone have any ideas ?

Gareth,

traverse isn't an HTML::Parser method. As far as I can see, from CPAN,
it never has been. That example isn't in the current lwpcook either.

I think your problem is that your lwp is rather old and your HTML::Parser is very new. 
You're getting incompatibilities.

Dave...



HTML:Parser

2001-01-29 Thread Gareth . Harper
Title: HTML:Parser





I've just installed HTML::Parser on a machine here.  It passed all of make, make test and make install fine. (output from make test pasted)

bash-2.02$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.00503/sun4-solaris -I/usr/local/lib/perl5/5.00503

 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/api_version...ok
t/argspec-bad...ok
t/argspec...ok
t/cases.ok
t/comment...ok
t/crashme...ok
t/declaration...ok
t/default...ok
t/dtext.ok
t/entities..ok
t/filterok
t/handler-eof...ok
t/handler...ok
t/headparser-http...ok
t/headparserok
t/ignoreok
t/largetags.ok
t/linkextor-baseok
t/linkextor-rel.ok
t/magic.ok
t/marked-sect...ok
t/offsetok
t/options...ok
t/parsefile.ok
t/parserok
t/process...ok
t/tokeparserok
t/uentities.skipping test on this platform
t/unbroken-text.ok
t/xml-mode..ok
All tests successful, 1 test skipped.
Files=30,  Tests=147, 48 wallclock secs (40.17 cusr +  5.53 csys = 45.70 CPU)


Then when I try to use it in the following file (which is a quick paste from lwpcook, with some changes to make it work in new seperate version of HTML::Parser) 

#!/usr/local/bin/perl -w
use strict;
use HTML::Parser;


my %link_elements =
  (
   'a'    => 'href',
   'img'  => 'src',
   'form' => 'action',
   'link' => 'href',
  );
  my $BASE = "http://www.sportal.co.uk/";
  my $parser = HTML::Parser->new();
  my $h = $parser->parse_file("/export/home/gharper/0,10225,1_1547_2168,00.htm");
  $h->traverse(\&expand_urls, 1);


  print $h->as_HTML;


  sub expand_urls
  {
 my($e, $start) = @_;
 return 1 unless $start;
 my $attr = $link_elements{$e->tag};
 return 1 unless defined $attr;
 my $url = $e->attr($attr);
 return 1 unless defined $url;
 $e->attr($attr, url($url, $BASE)->abs->as_string);
  }


The output I get from this is


Can't locate auto/HTML/Parser/traverse.al in @INC (@INC contains the followinng paths )


the paths arse set up correctly and pointing at where I installed the module, so I'm stumped.  Does anyone have any ideas ?

Gareth Harper
Engineering


[EMAIL PROTECTED]


SPORTAL LIMITED
40 parkgate road, london 
SW11 4JH, united kingdom
f:  +44 (0) 20  7350 4701 
m:  +44 (0) 7989 418742
http://www.sportal.com


CONFIDENTIALITY NOTICE
This e-mail is intended only for the above named addressee/s. The contents of the e-mail and any attached files are confidential and may be legally privileged. If you have received this e-mail in error please notify the sender immediately and then delete the e-mail, any attachments and any returned copy, without copying, forwarding, disclosing or otherwise using it in any way. Any content that does not relate to the official business of Sportal Limited or its associated companies shall be understood as neither given nor endorsed by it.