po: guard against reimportation

If po is imported twice, bad things happen. Guard against that.

I'm not sure what causes the double import; I saw it when websetup did a
wiki rebuild. Carp failed to show a backtrace for the second call to
import.
master
Joey Hess 2010-05-13 16:28:09 -04:00
parent 3f2f447cb5
commit 031da9c134
1 changed files with 14 additions and 12 deletions

View File

@ -51,6 +51,7 @@ sub import {
hook(type => "formbuilder_setup", id => "po", call => \&formbuilder_setup, last => 1);
hook(type => "formbuilder", id => "po", call => \&formbuilder);
if (! %origsubs) {
$origsubs{'bestlink'}=\&IkiWiki::bestlink;
inject(name => "IkiWiki::bestlink", call => \&mybestlink);
$origsubs{'beautify_urlpath'}=\&IkiWiki::beautify_urlpath;
@ -63,6 +64,7 @@ sub import {
inject(name => "IkiWiki::cgiurl", call => \&mycgiurl);
$origsubs{'rootpage'}=\&IkiWiki::rootpage;
inject(name => "IkiWiki::rootpage", call => \&myrootpage);
}
}