Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: HTM::TreeBuilder, HTML::Element's look_down() method

by afresh1 (Hermit)
on Oct 06, 2010 at 21:11 UTC ( #863867=note: print w/replies, xml ) Need Help??

in reply to HTM::TreeBuilder, HTML::Element's look_down() method

Pretty simple, $html is not a file, so $tree->parse_file won't work. Use $tree->parse instead.

With some additional error checking it would have even give you a clue: $tree->parse_file($html) or die $!;


Replies are listed 'Best First'.
Re^2: HTM::TreeBuilder, HTML::Element's look_down() method
by 7stud (Deacon) on Oct 06, 2010 at 21:24 UTC

    Ah, thanks! And I could just use the same method as in the first example. The examples I looked at didn't use die(). I should have thought of that myself.

    Thanks again!

      If you had done the same as the first example, it should have worked as well, however I would still recommend checking that it was successful.

      my $tree = HTML::TreeBuilder->new_from_content($html) or die $!;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863867]
[choroba]: My average XP per node lowered in the last three months :(
[choroba]: (check my homenode for the graph link and the tool to create it)
[LanX]: blocked by FW :(
oldtechaa takes a cookie from the platter on the sideboard.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-04-26 12:02 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (474 votes). Check out past polls.