Skip non-readable files in Module/Pluggable/Object.pm
This enables a poor man's authorization of plugins on file system basis.
E.g., MooX::Cmd uses this module to discover subcommands. Withdrawing read permission on files enables allowing different user groups to execute different command sets without touching the code at all.
Hi @sschober this patch doesn't quite work because the code path you put the test in only gets called if we're trying to work out what the package name is (when the package name is not mixed case).
The best way to achieve what you want is to do something like
use Module::Pluggable search_path => "MooX::Cmd",
require => 1,
on_require_error => sub { 0 };
Which will just silently not load plugins that can't be read. I can modify the triggers so that they pass in the file they're trying to load if necessary so that you could do a test like
use Module::Pluggable search_path => "MooX::Cmd",
require => 1,
on_require_error => sub { my ($pkg, $err, $file) = @_; -r $file}; # ignore the error if file is not readable