> Sorry--you're quite right... it's not a mandatory warning at all any more. I
> run all my scripts when developing under -w, so I still get the warning.
>
> I think it would be useful to specifically check that the sub is not already
> defined in the caller's namespace:
> if (!(defined &{"${pkg}::$name"})) {
> <import the const sub>
> }
>
> This works fine for me... without it, it's very hard to notice many warnings
> which provide useful diagnostic information. Worse still, some people may
> just turn off -w altogether to avoid their logs filling up.
this only happens when Apache::Registry re-compiles your script. you can
avoid this by moving your subroutines into modules, which are only
reloaded if FreshStart is on or Apache::StatINC is configured. both of
which disable warnings when re-loading. the other solution would be
subclass Apache::RegistryNG with just a compile method like so:
sub compile {
my $self = shift;
local $^W = 0;
$self->SUPER::compile(@_);
}
or hack Registry.pm like so:
--- lib/Apache/Registry.pm 2000/04/05 06:19:34 1.31
+++ lib/Apache/Registry.pm 2000/04/20 20:26:14
@@ -173,6 +173,7 @@
sub compile {
my $eval = shift;
Apache->untaint($eval);
+ local $^W = 0;
eval $eval;
}