Gossamer Forum
Home : Products : Links 2.0 : Customization :

Should i add this?!?

Quote Reply
Should i add this?!?
hola,

i've modified the sub build_stats from nph-build.cgi in order to display the what's new page sorted by contact name:

my (@values, $category, $cat, @alt_categories, @categorylist, $depth, $i, $cat);
my $staggered_mode = shift || undef;

open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$category = $values[$db_category];
$bhl_new = $values[$db_contact_name];

# Add the link to the list of links.
push (@{$links{$category}}, @values) if (!$staggered_mode);
$grand_total++;

# Add the link to the alternate categories as well.
if (defined $db_alt) {
@alt_categories = split(/\Q$db_delim\E/, $values[$db_alt]);
foreach (@alt_categories) {
push (@{$links{$_}}, @values);
}
}

# Add the link to the list of new links if it is new.
# 13/09/00 - Modifica per ottenere una lista in base alla... data? titolo?

push (@{$new_links{$bhl_new}}, @values) if ($values[$db_isnew] eq "Yes");

and... it works... a bit slow but works... now i've got 2 questions:

a) should i add the $bhl_new variable to my (@values, $category, $cat, @alt_categories etcetera???
b) yes/no, why?

thanks a lot!!!

ciao:)

Quote Reply
Re: Should i add this?!? In reply to
Yes...because it is a localized variable you are using...for more information on local variables (either my or local), search http://www.perl.com for information on local variables.

Regards,

Eliot Lee