Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"

by Anonymous Monk
on Nov 26, 2014 at 19:39 UTC ( [id://1108498]=note: print w/replies, xml ) Need Help??


in reply to Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"

... or is it something else?

Its a bug/limitation/oversight of HTML::TagParser ... its why HTML::TreeBuilder is more popular , sure it doesn't have the DOMish names, but its got HTML::TreeBuilder::XPath and htmltreexpather.pl :)
HTML::TagParser is depended on by 7 distributions
HTML::TreeBuilder is depended on by 180 distributions

Also, you posted too much stuff, narrow it down (aka clean your room )

#!/usr/bin/perl -- use strict; use warnings; use HTML::TagParser; my $html = HTML::TagParser->new(q{ <div id="bug"> <span class="type"> yo </span> <span class="type"> ho </span> <span class="type"> ho </span> </div> }); my $bug = $html->getElementById("bug"); my @sss = $bug->getElementsByClassName("type"); __END__ Can't locate object method "getElementsByClassName" via package "HTML: +:TagParser::Element" at - line 13.
  • Comment on Re: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"
  • Download Code

Replies are listed 'Best First'.
Re^2: Can't locate object method "getElementsByClassName" via package "HTML::TagParser::Element"
by Vonunov (Novice) on Nov 26, 2014 at 19:49 UTC

    I worried that if I tried to trim anything I would cut out the part that magically makes my problem happen even though it looks like it has nothing to do with it. :P

    Thanks, I'll try that module then.

      Making the effort of trimming your code to a more reasonable length and still exhibit the problem might actually help you figuring out by yourself where the error is. And it will make it easier for us to help you if you did not solve the problem yourself in the course of that process.

      I worried that if I tried to trim anything I would cut out the part that magically makes my problem happen even though it looks like it has nothing to do with it. :P

      Thats why you make a copy of the file each time you trim, that way, if the problem disappears, you can go back a file ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1108498]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found