Thanks for your quick response.
Matthew Lawrence via RT schrieb:
Show quoted textThis is what I see when using find_in_namespace() on a Debain Etch with
perl 5.8.8 (output slightly abbreviated):
perl -e'use Module::Util qw(find_in_namespace); print join( "\n",
find_in_namespace("Module"))."\n"; print "warnings: ".($^W ? "ON" :
"OFF" )."\n"; '
Can't stat /etc/perl/Module: Datei oder Verzeichnis nicht gefunden
at /usr/local/share/perl/5.8.8/Module/Util.pm line 215
Can't stat /usr/local/lib/perl/5.8.8/Module: Datei oder Verzeichnis
nicht gefunden
at /usr/local/share/perl/5.8.8/Module/Util.pm line 215
Module::Build
Module::Util
warnings: OFF
Show quoted text> As far as I know, the warnings pragma doesn't work at a distance, so if
> warnings are originating in File::Find, there's not a lot I can do to
> suppress them. Also, as far as I'm aware, enabling lexical warnings in
> Module::Util won't cause them to be enabled anywhere else.
>
> e.g.
>
> perl -le '{ package Foo; use warnings; sub foo { print undef } }
> Foo::foo; print undef'
> Use of uninitialized value in print at -e line 1.
>
> -- only one warning appears - use warnings in package Foo doesn't
> affect main
>
> perl -le '{ package Foo; use warnings; sub foo { print undef } } no
> warnings; Foo::foo'
> Use of uninitialized value in print at -e line 1.
>
> -- no warnings in main doesn't affect Foo
>
>
>
File::Find is making use of warnings::register and warnings::warnif (see
perldoc warnings) which are working from the caller's perspective. Hence
saying "no warnings 'File::Find';" in Module::Util prior to the call of
File::Find::find should suffice for suppressing the warnings originating
in File::Find. For some reason that I could not track down yet, passing
the warnings category File::Find as described in the docs of File::Find
fails. But saying "no warnings;" is OK.
As to the lexical nature of the warnings pragma putting "no warnings;"
within Module::Util::_find_modules should not affect the rest of the
code regarding warnings in Module::Util.
Cheers,
Alexander
Show quoted text> $SIG{__WARN__} can be used to trap warnings no matter where they
> originate. I would consider using that in Module::Util, if there's no
> cleaner solution.
>
> Cheers,
>
> Matt
>
>
>
Show quoted text> On Fri Nov 14 11:30:48 2008, ALEXK wrote:
>
>> Hi,
>> again me ;)
>> Turning on lexical warnings for Module::Util leads to a very verbose
>> File::Find::find() call in the Module::Util::_find_modules sub. As a
>> module user of Module::Util it's impossible - at least to my knowledge -
>> to suppress the warnings originating in File::Find::find() without
>> setting the -X perl flag.
>>
>> What about adding a 'no warnings;' just before calling
>>
> File::Find::find()?
>
>
>
>> A 'no warnings qw(File::Find);' as documented for cases like this in
>> File::Find fails for some reason ...
>>
>> Alexander
>>
>
>
>