On Sat, Jan 05, 2002 at 10:17:34PM +0100, Mattia Barbon wrote:
> > On Wed, Jan 02, 2002 at 05:37:28PM +0100, Mattia Barbon wrote:
> > > I don't care for the variable name, but I'd really like
> > > to have this feature.
> >
> > Would it work ok as a Test::Builder accessor method rather than an
> > environment variable?
> No, unfortunately, because the call order is like this:
> * init code in the backend
> * BEGIN blocks of the program ( including use Foo; )
> * B::Backend::compile
> * the coderef returned by B::Backend::compile
>
> So I can't call the method from the init code in the backend,
> because Test::Builder hasn't been loaded yet, and calling it from
> the ::compile is too late ( output is already lost ); the
> alternative I see is to use a package variable; so I can set
> $Test::Builder::i_want_the_output_even_if_dollar_caret_C_is_1 = 1;
> in initialization code.
You could do this:
require Test::Builder;
my $tb = Test::Builder->new;
$tb->output_even_if_compiling(1);
in the init code. Since Test::Builder is a singleton your settings
should stick.
Here's an interesting alternative. Do C<local $^C = 0> just before
running the tests, though that's pretty ugly.
> But I rwally like the environment variable better, because with the
> package variable solution I need to set it unconditionally ( because
> for it to have effect it must be set in the init code, and in the
> init code I can't look at parameters, because parameters are passed
> in the call to compile, so I can't set it using a parameter ), and
> because I was hoping to keep B::C clear from
> hacks-to-make-the-testsuite-happy.
>From my PoV, I'm hoping to keep Test::Builder clear from
hacks-to-make-perlcc-happy. :) The $^C thing is already a hack for
B::Deparse.
Could you explain again why you need test output while compiling, I'm
not quite following. Assume you had the I_WANT_OUTPUT_DURING_COMPILE
environment variable could you show how you'd be using it?
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
<Skrewtape> I've heard that semen tastes different depending on diet. Is that
true?
<Skrewtape> Hello?
<Schwern> Skrewtape: Hang on, I'm conducting research.