| 1133 | | my $rv = eval "use $class; $class->load; 1;"; |
| 1134 | | return $mc->err($@) if ! $rv && $@ !~ /^Can\'t locate/; |
| 1135 | | return $rv; |
| 1136 | | }; |
| 1137 | | |
| 1138 | | my $rv = $load->($fn) || $load->(lc $fn) || $load->(ucfirst lc $fn); |
| 1139 | | return $mc->err($@) unless $rv; |
| 1140 | | |
| 1141 | | $PluginCase{lc $fn} = $last_case; |
| 1142 | | $plugins{$last_case} = $last_class; |
| 1143 | | |
| 1144 | | return $mc->ok; |
| | 1136 | my $file = $class . ".pm"; |
| | 1137 | $file =~ s!::!/!g; |
| | 1138 | |
| | 1139 | my $rv = eval "use $class; 1;"; |
| | 1140 | |
| | 1141 | if ($rv) { |
| | 1142 | $good_error = undef; |
| | 1143 | last; |
| | 1144 | } |
| | 1145 | |
| | 1146 | # If we don't have a good error yet, start with this one. |
| | 1147 | $good_error = $@ unless defined $good_error; |
| | 1148 | |
| | 1149 | # If the file existed perl will place an entry in %INC (though it will be undef due to compilation error) |
| | 1150 | if (exists $INC{$file}) { |
| | 1151 | $good_error = $@; |
| | 1152 | last; |
| | 1153 | } |
| | 1154 | } |
| | 1155 | |
| | 1156 | unless (defined $good_error) { |
| | 1157 | my $rv = eval "$last_class->load; 1;"; |
| | 1158 | |
| | 1159 | if ($rv) { |
| | 1160 | $PluginCase{lc $fn} = $last_case; |
| | 1161 | $plugins{$last_case} = $last_class; |
| | 1162 | return $mc->ok; |
| | 1163 | } |
| | 1164 | |
| | 1165 | $good_error = $@; |
| | 1166 | } |
| | 1167 | |
| | 1168 | return $mc->err($good_error); |