This page was moved from the Toolserver wiki. Toolserver has been replaced by Toolforge. As such, the instructions here may no longer work, but may still be of historical interest. Please help by updating examples, links, template links, etc. If a page is still relevant, move it to a normal title and leave a redirect.
#!/usr/bin/perlusestrict;# 'strict' insists that all variables be declaredusediagnostics;# 'diagnostics' expands the cryptic warningsrequire'bin/fetch_articles_cats2.pl';undef$/;# undefines the separator. Can read one whole file in one scalar.subfetch_articles{my($article,@articles,$cat,$cats,$text,%new_article,$cont_cat);my(%excluded_cats,%cat_hash,$text_cats,$newcats,@tmp,$newcat,$basecat,$new_articles,%newcat_hash);$cats=$_[0];$new_articles=$_[1];$newcats=$_[2];foreach$cat(@$cats){$cat_hash{$cat}=1;}# Start harvesting the articles from these categoriesforeach$cat(@$cats){&fetch_articles_cats($cat,\@tmp,\@articles);print"<font color=red>Error! No articles in $cat !!!</font><br>\n"unless(@articles);foreach$newcat(@tmp){nextif(exists$cat_hash{$newcat}||exists$newcat_hash{$newcat});print"Detected new $newcat in $cat<br>\n";$newcat_hash{$newcat}=1;push(@$newcats,$newcat);}foreach$article(@articles){nextif($article=~ /:/);# ignore everything outside of the article namespace nextif(exists$new_article{$article});$new_article{$article}=1;# discovered new artilepush(@$new_articles,$article);}}}1;