Gossamer Forum
Home : Products : Links 2.0 : Customization :

LastLink error, please help

Quote Reply
LastLink error, please help
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:

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



Quote Reply
Re: LastLink error, please help In reply to
Thanks. I had only added three entrys into the database for testing. I added a few more and it worked great, thanks :-)

Patrick
Quote Reply
Re: LastLink error, please help In reply to
Hmmm ... are you using an empty database? LastLink only works with at least six (6) links in the database.

(I really need to update the instructions ...)

John
Quote Reply
Re: LastLink error, please help In reply to
John is correct...

The following error:

Quote:
Error Message : fatal error: Modification of non-creatable array value attempted, subscript -3 at nph-build.cgi line 1023.

means that you do not have at least six links in your links.db file.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.