From: Joey Hess Date: Thu, 24 Mar 2011 21:55:03 +0000 (-0400) Subject: avoid stomping on inline's rootpage sub if it's not already present X-Git-Tag: 3.20110328~7 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/f39d02583abee54d1c7792dcc171db6bba226091?ds=sidebyside;hp=9f7f12809041ab70fdde1f9695d450c64b1ca675 avoid stomping on inline's rootpage sub if it's not already present If the inline plugin is not being loaded, or is perhaps loaded after po (when IkiWiki::Setup::getsetup loads all the plugins, for example), po should not inject its custom rootpage sub, as that will lead to a redefinition error message when inline loads. --- diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 4f8d5036e..0ea35b21c 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -66,8 +66,11 @@ sub import { inject(name => "IkiWiki::urlto", call => \&myurlto); $origsubs{'cgiurl'}=\&IkiWiki::cgiurl; inject(name => "IkiWiki::cgiurl", call => \&mycgiurl); - $origsubs{'rootpage'}=\&IkiWiki::rootpage; - inject(name => "IkiWiki::rootpage", call => \&myrootpage); + if (IkiWiki->can('rootpage')) { + $origsubs{'rootpage'}=\&IkiWiki::rootpage; + inject(name => "IkiWiki::rootpage", call => \&myrootpage) + if defined $origsubs{'rootpage'}; + } $origsubs{'isselflink'}=\&IkiWiki::isselflink; inject(name => "IkiWiki::isselflink", call => \&myisselflink); }