in reply to Can't suppress missing package warning
The reason for the appearance of the warning is that the test code does not use warnings. test.pl is run without warnings, whereas t/blah.t is run with warnings enabled. If you add use warnings to test.pl you get the same issue. It seem to me anyone that uses this module with warnings enabled is going to get this warning unless they also supress it or don't use warnings. All you need to make it go away is simple no warnings before setting @ISA for package C. This is valid as the Module requires 5.6+ For package D the second argument of @ISA is obviously not evaluated as it does not generate a warning.
use Test; BEGIN { plan tests => 3 }; use Class::Dynamic; use warnings; # added to show point ok(1); our $testval = time & 1; package A; sub number { return 12 } package B; sub number { return 42 } package C; no warnings; @ISA = ( sub { $main::testval ? "A" : "B" } ); package D; @ISA = ( "A", sub { $main::testval ? "A" : "B" } ); package main; ok (C->number == ($testval ? 12 : 42)); ok (D->number == 12);
cheers
tachyon
|
|---|