Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Can't locate auto/HTML/TreeBuilder/disembowel.al

by pingo (Hermit)
on Sep 14, 2004 at 13:31 UTC ( #390834=perlquestion: print w/replies, xml ) Need Help??

pingo has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am having trouble with the HTML::TreeBuilder module and would appreciate any help. The problem is that when I run my script as a cgi, I get the following error message:

Can't locate auto/HTML/TreeBuilder/disembowel.al in @INC (@INC contains: ...) at html_treebuilder.cgi line 12.

But when I run the same script from the prompt, it works fine, which is nice but somewhat confusing.

Here are the relevant parts of the code:

use HTML::TreeBuilder;

my $tree = HTML::TreeBuilder->new;
$tree->parse_file('/www/html_treebuilder.html');

$tree = $tree->disembowel();

print "Content-type: text/html\n\n";
print $tree->as_HTML(), "\n";

$tree = $tree->delete;

If I remove the disembowel line, it works fine.

Update: Case solved (or at least identified); it was a case of different versions of the module.
  • Comment on Can't locate auto/HTML/TreeBuilder/disembowel.al

Replies are listed 'Best First'.
Re: Can't locate auto/HTML/TreeBuilder/disembowel.al
by ikegami (Pope) on Sep 14, 2004 at 14:16 UTC

    Well that's odd. HTML::TreeBuilder from HTML-Tree-3.18 and it base classes are pure perl modules which don't use dynaloader or even AUTOLOAD. So why would perl be looking for a .al? disembowel is defined as sub disembowel { $_[0]->guts(1) } in TreeBuilder.pm

      My version of TreeBuilder is 3.13, but it seems it is much the same as 3.18 (the sub is the same, at least).
        perl - <<'__EOP__' use HTML::TreeBuilder; print($HTML::TreeBuilder::VERSION, "\n"); print($INC{'HTML/TreeBuilder.pm'}, "\n"); my $tree = HTML::TreeBuilder->new; print($tree, "\n"); $tree->parse_file('file.html'); print($tree, "\n"); print('new_from_content: ', $::{'HTML::'}{'TreeBuilder::'}{'new_from_content'}?'yes':'no', "\n"); print('stunt: ', $::{'HTML::'}{'TreeBuilder::'}{'stunt' }?'yes':'no', "\n"); print('disembowel: ', $::{'HTML::'}{'TreeBuilder::'}{'disembowel' }?'yes':'no', "\n"); __EOP__

        HTML-Tree-3.11 looks like:

        3.11 r:/Utils/perl/site/lib/HTML/TreeBuilder.pm HTML::TreeBuilder=HASH(0x1abf008) HTML::TreeBuilder=HASH(0x1abf008) new_from_content: yes stunt: yes disembowel: no

        Disembowel doesn't exist in this version.

        HTML-Tree-3.18 should look like:

        3.13 r:/Utils/perl/site/lib/HTML/TreeBuilder.pm HTML::TreeBuilder=HASH(0x1abf008) HTML::TreeBuilder=HASH(0x1abf008) new_from_content: yes stunt: yes disembowel: yes
Re: Can't locate auto/HTML/TreeBuilder/disembowel.al
by JSchmitz (Canon) on Sep 14, 2004 at 14:21 UTC
    @nodes = $root->disembowel() $parent_for_nodes = $root->disembowel()
    The disembowel() method works just like the guts() method, except that disembowel definitively destroys the tree above the nodes that are returned. Usually when you want the guts from a tree, you're just going to toss out the rest of the tree anyway, so this saves you the bother. (Remember,``disembowel'' means ``remove the guts from''.)

    This is straight from the docs
      Thanks, but I am not sure how this relates to my problem?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://390834]
Approved by Limbic~Region
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2021-01-20 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?