icon Learn how to get the most out of Surmunity - read our forum tips here! | Welcome! Please register to access all of our features.
Old April 18th, 2008, 9:09 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Mar 2008
4 posts
Gave thanks: 0
Thanked 0 times
Need help using perl module

Hi,

I'm trying to use the HTML::TreeBuilder perl module on one of my webpages. I went through the perl module install page on cpanel. It looked like it was already installed though. The text was:

Quote:
Method: Perl Expect
Fetching CPAN timestamp...Done
Testing connection speed...(this could take a while)...Done
Ping:32.788 Testing connection speed to ftp.osuosl.org using pureperl...(34700.00 bytes/s)...Done
Ping:31.361 Testing connection speed to cpan.pair.com using pureperl...(44614.29 bytes/s)...Done
Ping:28.580 Testing connection speed to cpan-du.viaverio.com using pureperl...(310.98 bytes/s)...Done
Three usable mirrors located
Three usable mirrors located
Mirror Check passed for cpan.pair.com (/index.html)
CPAN: File::HomeDir loaded ok (v0.69)
CPAN: Storable loaded ok (v2.18)
Going to read /home/<removed user name>/.cpan/Metadata
Database was generated on Thu, 17 Apr 2008 05:29:46 GMT
HTML::TreeBuilder is up to date (3.23).
perlmod--Install done
The code for my page looks like this:
Code:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);

my $homedir = (getpwuid($>))[7];
my $n_inc = scalar @INC;
for (my $i = 0; $i < $n_inc; $i++ ) {
     if (-d $homedir . '/perl' . $INC[$i]) {
         unshift(@INC,$homedir . '/perl' . $INC[$i]);
         $n_inc++;
         $i++;
     }
}

use HTML::TreeBuilder;
require LWP::UserAgent;

print "Content-type: text/html;\n\n";

my $ua = LWP::UserAgent->new();
my $response = $ua->get(<url removed>);
my $root = HTML::TreeBuilder->new_from_content($response->content);
print $root->as_HTML;
$root = $root->delete();
When I run the page I get this error:
Quote:
Can't locate HTML/TreeBuilder.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8/i686-linux /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i686-linux /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.4/i686-linux /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl/5.6.2 /usr/lib/perl5/site_perl .) at <filename removed> line 14.
BEGIN failed--compilation aborted at <filename removed> line 14.
I'm using the code that the install module page syas to use to add your home directory to the include path but that doesn't seem to work.
Any suggestions?
toolh3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 24th, 2008, 7:04 AM   #2 (permalink)
﴾͡๏̯͡๏﴿...tweet
Super #1
 
Joined in Dec 2005
5,385 posts
Gave thanks: 125
Thanked 142 times
Blog Entries: 4
Quote:
Originally Posted by toolh3 View Post
I'm using the code that the install module page syas to use to add your home directory to the include path but that doesn't seem to work.
Any suggestions?
can you reply with what you're using as your home directory path?
__________________
jam
Brandonnn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old April 24th, 2008, 8:20 AM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Mar 2008
4 posts
Gave thanks: 0
Thanked 0 times
I'm using this code section to set the include path with my home directory:
Code:
my $homedir = (getpwuid($>))[7];
my $n_inc = scalar @INC;
for (my $i = 0; $i < $n_inc; $i++ ) {
     if (-d $homedir . '/perl' . $INC[$i]) {
         unshift(@INC,$homedir . '/perl' . $INC[$i]);
         $n_inc++;
         $i++;
     }
}
From following that code, it just takes my user id and concatenates '/perl' to it. That directory exists but it has nothing in it (at least nothing that I can see). I installed HTML::TreeBuilder through cpanel without any errors so I assumed it was put in the correct directories.
toolh3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On