I'm trying to do a simple tutorial but I'm having trouble getting started. My problem seems to be installing and getting the correct path to the modules.
******1. Here is the original code:***********
#!/usr/bin/perl -w
use strict;
use LWP 5.64;
my $browser = LWP::UserAgent->new;
my $url = 'my $response = $browser->get($url);
die "Can't get $url -- ", $response->status_line
unless $response->is_success;
my $html = $response->content;
while( $html =~m/<A HREF=\"(.*?)\"/g ) {
print "$1\n";
******2. But in Host Gator they say this:******
Location of Your Perl Module(s)
Path: /home/dgertgen/perl
Using Your Perl Module(s)
You will need to add /home/dgertgen/perl to the include path.
You can do this by adding the following code to your script:
BEGIN {
my $base_module_dir = (-d '/home/dgertgen/perl' ? '/home/dgertgen/perl' : ( getpwuid($>) )[7] . '/perl/');
unshift @INC, map { $base_module_dir . $_ } @INC;
}
******3. So I added the code but have no idea if I added it in the correct spot.******
#!/usr/bin/perl -w
use strict;
use LWP 5.64;
BEGIN {
my $base_module_dir = (-d '/home/dgertgen/perl' ?
'/home/dgertgen/perl' : ( getpwuid($>) )[7] . '/perl/');
unshift @INC, map { $base_module_dir . $_ } @INC;
}
my $browser = LWP::UserAgent->new;
my $url = 'my $response = $browser->get($url);
die "Can't get $url -- ", $response->status_line
unless $response->is_success;
my $html = $response->content;
while( $html =~m/<A HREF=\"(.*?)\"/g ) {
print "$1\n";
Any help would be greatly appreciated.
FYI, I already made sure the file has the needed permissions 755
******1. Here is the original code:***********
#!/usr/bin/perl -w
use strict;
use LWP 5.64;
my $browser = LWP::UserAgent->new;
my $url = 'my $response = $browser->get($url);
die "Can't get $url -- ", $response->status_line
unless $response->is_success;
my $html = $response->content;
while( $html =~m/<A HREF=\"(.*?)\"/g ) {
print "$1\n";
******2. But in Host Gator they say this:******
Location of Your Perl Module(s)
Path: /home/dgertgen/perl
Using Your Perl Module(s)
You will need to add /home/dgertgen/perl to the include path.
You can do this by adding the following code to your script:
BEGIN {
my $base_module_dir = (-d '/home/dgertgen/perl' ? '/home/dgertgen/perl' : ( getpwuid($>) )[7] . '/perl/');
unshift @INC, map { $base_module_dir . $_ } @INC;
}
******3. So I added the code but have no idea if I added it in the correct spot.******
#!/usr/bin/perl -w
use strict;
use LWP 5.64;
BEGIN {
my $base_module_dir = (-d '/home/dgertgen/perl' ?
'/home/dgertgen/perl' : ( getpwuid($>) )[7] . '/perl/');
unshift @INC, map { $base_module_dir . $_ } @INC;
}
my $browser = LWP::UserAgent->new;
my $url = 'my $response = $browser->get($url);
die "Can't get $url -- ", $response->status_line
unless $response->is_success;
my $html = $response->content;
while( $html =~m/<A HREF=\"(.*?)\"/g ) {
print "$1\n";
Any help would be greatly appreciated.
FYI, I already made sure the file has the needed permissions 755