I'm having trouble installing the lastlink mod (v1.99). I have everything modified according to the instructions, double checked, but I keep getting this error when building the page.
CGI ERROR
==========================================
Error Message : fatal error: Modification of non-creatable array value attempted, subscript -3 at nph-build.cgi line 1023.
Script Location : nph-build.cgi
Perl Version : 5.00402
Here's my build_home_page sub:
# --------------------------------------------------------
my ($subcat, @rootcat);
local ($total);
# Check to see which categories are off of the root.
foreach $subcat (sort keys %category) {
if ($subcat =~ m,^([^/]*)$,) {
push (@rootcat, $subcat);
}
}
print "\tSubcategories: "; print $#rootcat+1; print "\n";
print "\tTotal Links: $grand_total\n";
print "\tOpening page: $build_root_path/$build_index\n";
### Mod Start ###
# LastLink 1.99
###
my $LastX = 5;
open (DB, "<$db_file_name") or &cgierr("unable to open database:$db_file_name.\nReason: $!");
my @lines = <DB>;
close DB;
for ($i=$#lines; $i>=$#lines - $LastX; $i--) {
chomp $lines[$i];
@tmp = &split_decode ($lines[$i]);
%tmp = &array_to_hash (0, @tmp);
$lastlink .= &site_html_link (%tmp);
}
### MOD End ###
open (HOME, ">$build_root_path/$build_index") or &cgierr ("unable to open home page: $build_root_path/$build_index. Reason: $!");
$category = &site_html_print_cat (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_home;
close HOME;
print "\tClosing page.\n";
}
Any ideas?
Thanks,
Patrick
CGI ERROR
==========================================
Error Message : fatal error: Modification of non-creatable array value attempted, subscript -3 at nph-build.cgi line 1023.
Script Location : nph-build.cgi
Perl Version : 5.00402
Here's my build_home_page sub:
Code:
sub build_home_page { # --------------------------------------------------------
my ($subcat, @rootcat);
local ($total);
# Check to see which categories are off of the root.
foreach $subcat (sort keys %category) {
if ($subcat =~ m,^([^/]*)$,) {
push (@rootcat, $subcat);
}
}
print "\tSubcategories: "; print $#rootcat+1; print "\n";
print "\tTotal Links: $grand_total\n";
print "\tOpening page: $build_root_path/$build_index\n";
### Mod Start ###
# LastLink 1.99
###
my $LastX = 5;
open (DB, "<$db_file_name") or &cgierr("unable to open database:$db_file_name.\nReason: $!");
my @lines = <DB>;
close DB;
for ($i=$#lines; $i>=$#lines - $LastX; $i--) {
chomp $lines[$i];
@tmp = &split_decode ($lines[$i]);
%tmp = &array_to_hash (0, @tmp);
$lastlink .= &site_html_link (%tmp);
}
### MOD End ###
open (HOME, ">$build_root_path/$build_index") or &cgierr ("unable to open home page: $build_root_path/$build_index. Reason: $!");
$category = &site_html_print_cat (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_home;
close HOME;
print "\tClosing page.\n";
}
Any ideas?
Thanks,
Patrick