On Mon, Nov 9, 2009 at 12:41 PM, Philippe Bruhat (BooK)
<philippe.bru...@free.fr> wrote:
> On Mon, Nov 09, 2009 at 02:24:11AM -0800, Ovid wrote:
>> --- On Mon, 9/11/09, Ovid <publiustemp-perl...@yahoo.com> wrote:
>>
>> > From: Ovid <publiustemp-perl...@yahoo.com>
>>
>> > The *only* use I've ever had for use_ok() has been in a
>> > t/00-load.t test which attempts to load all modules and does
>> > a BAIL_OUT if it fails.  I'm sure there are other use
>> > cases, but if that's the only one, it seems a very, very
>> > slim justification for a fragile code.
>>
>> Thinking about this more, what about a compile_ok()?  It merely
>> asserts that the code compiles (in an anonymous namespace, perhaps?),
>> but doesn't make any guarantees about you being able to even use the
>> code -- just that it compiles.  It wouldn't need to be done at BEGIN
>> time, nor would it necessarily require a "or die" after it, since its
>> availability is not guaranteed (though that would be problematic as
>> cleaning a namespace is also fragile).
>>
>> Just tossing out ideas here.
>>
>
> compile_ok() would certainly be interesting with scripts shipped with
> a module, that usually have very little meat that needs testing (since
> most of the work is done in the modules), but that one would at least
> check that they compile.

If I understand this would either do

perl -c blib/lib/Module/Name.pm
or
perl -Iblib/lib -MModule::Name -e1


I think there are several Test:: modules on CPAN that does this and I know I
have implemented something similar at least 4 times at various degrees
of brokenness.  I am sure other have similar code.

Having compile_all_pm_ok() would be also useful.

Gabor

Reply via email to