perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: cvs commit: modperl-2.0/lib/ModPerl TestRun.pm
Date Sun, 09 Nov 2003 02:23:45 GMT
Geoffrey Young wrote:
>  but I kinda thought the delayed eval made it a bit
> 
>>> neater - that's the added value :)
>>
>>
>>
>> Delayed eval? I fail to see where the delay is coming from? You run 
>> eval {} in generate_script, 
> 
> 
> don't take delay too literally.  it was just a bad choice of words on my 
> part - we both know what the code is doing :)

Yes, but I thought that you really wanted to have a hook that will run from 
t/TEST. That's why I couldn't figure out how have you planned to accomplish 
that with passing a CODEREF ;)

You said that it gives the benefit of having an access to config stuff:

# subroutines are eval'd when t/TEST is generated, so config-time
# variables such as Apache::TestConfig::IS_MOD_PERL_2 can be used

but you get them anyway ;)


>> so why not just run it in Makefile.PL and pass the result? 
> 
> 
> because that's messy and not really what people want from an API.

Is this more messier:
   generate_script(bugreport => My::Foo::bugreport());
than:
   generate_script(bugreport => \&My::Foo::bugreport);

I believe on the opposite the first form is clear, whereas the second is 
obscure, since you have no idea when is it going to be executed, leading some 
to think that it will be executed from t/TEST.

>> I think with the proposed patch these 2 things do exactly the same 
>> thing at exactly (well almost) the same time:
>>
>> generate_script(bugreport => \&My::Foo::bugreport);
>> generate_script(bugreport => My::Foo::bugreport());
> 
> 
> sure, you can run the second form as well.
> 
> as I said I don't really care, so I'll just take the cv logic out.

I guess if people need to write a real function that does things besides 
printing some string, they should use t/TEST.PL

Also I'd like to suggest another change. If you introduce key=>val arguments, 
the old arg should support that as well, like so:

generate_script( file      => 't/TEST',
                  bugreport => My::Foo::bugreport());

What do you think? And we keep the back-compat:

generate_script('t/TEST');

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message