}
sub getlibdirs () {
+ my $libdirs;
if (! ref $config{libdir}) {
if (length $config{libdir}) {
- return [$config{libdir}];
+ $libdirs = [$config{libdir}];
} else {
- return [];
+ $libdirs = [];
}
+ } else {
+ $libdirs = $config{libdir};
}
- return $config{libdir};
+ return @{$libdirs};
}
sub defaultconfig () {
sub listplugins () {
my %ret;
- foreach my $dir (@INC, @{getlibdirs()}) {
+ foreach my $dir (@INC, getlibdirs()) {
next unless defined $dir && length $dir;
foreach my $file (glob("$dir/IkiWiki/Plugin/*.pm")) {
my ($plugin)=$file=~/.*\/(.*)\.pm$/;
$ret{$plugin}=1;
}
}
- foreach my $dir (@{getlibdirs()}, "$installdir/lib/ikiwiki") {
+ foreach my $dir (getlibdirs(), "$installdir/lib/ikiwiki") {
next unless defined $dir && length $dir;
foreach my $file (glob("$dir/plugins/*")) {
$ret{basename($file)}=1 if -x $file;
sub loadplugins () {
if (defined $config{libdir} && length $config{libdir}) {
- foreach my $dir (@{getlibdirs()}) {
+ foreach my $dir (getlibdirs()) {
unshift @INC, possibly_foolish_untaint($dir);
}
}
return if ! $force && grep { $_ eq $plugin} @{$config{disable_plugins}};
- foreach my $possiblytainteddir (@{getlibdirs()}, "$installdir/lib/ikiwiki") {
+ foreach my $possiblytainteddir (getlibdirs(), "$installdir/lib/ikiwiki") {
my $dir = defined $possiblytainteddir ? possibly_foolish_untaint($possiblytainteddir) : undef;
if (defined $dir && -x "$dir/plugins/$plugin") {
eval { require IkiWiki::Plugin::external };