* Shlomi Fish <[EMAIL PROTECTED]> [2006-07-21 20:05]:
> On Friday 21 July 2006 19:50, A. Pagaltzis wrote:
> >I assume it’s because, despite the order in the file, the
> >BEGIN block runs before the `plan tests => 2` line.
> >
> >Sure looks like a bug.
> 
> I don't think that it is. Perl preprocesses the files and at
> compile time executes any BEGIN { ... } blocks it encounters
> and execute them before the rest of the program. If you want to
> execute the plan at the beginning either also put it in a BEGIN
> { ... } block, or use the "use Test::More tests => $num_tests"
> directive.
> 
> It's not a bug - it's a feature. BTW, the "use" Perl keyword is
> also executed in compile time. There's some equivalent code to
> it in "perldoc -f use":

Errm, I think I foggily remember having written some Perl code
before, even uploading some of it a called… CPAN? I think. Yeah,
something tells me that’s how BEGIN works and is supposed to
work…

*cough*

Of *course* it’s not BEGIN that’s buggy. I was commenting on the
fact that nothing in T::B/T::M screams bloody murder when you run
a test before you’ve declared your plan. Assuming I conjectured
correctly, then if that’s what not a bug, I don’t know what is.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to