Coding Together

Edwardson, Tony Tony.Edwardson at commerzbank.com
Thu Dec 20 06:48:06 PST 2007


All we are doing at the moment is finding out what the state of each module
is - that is probably best done by the more experienced guys for the very
reason that the code listed below doesn't actually test anything

 

For the record

 

The first line is a BEGIN block which get's performed before anything else 

$| = 1;

Sets up autoflushing whenever you output something to stderr (i.e. stops it
buffering output)

print "1..1\n"; 

prints out 1..1 to stdout which is expected by the test harness and means
run 1 test out of a total of 1 

 

Surprisingly END { .... } is the converse of a BEGIN block and gets executed
after everything else

It will print out "not ok 1" is the variable $loaded is not a true value
(which it always wil be because it is set to 1 explicitly - so the END block
will never do anything

Next it prints "ok 1" which tells Test::Harness that test 1 worked although
iot never actually runs any tests

 

 

So, basically, this is a stub-with no tests defined and just outputs enough
to keep Test::Harness quiet

 

Cheers

Tony 

   _____  

From: miltonkeynes-pm-bounces+tony.edwardson=commerzbank.com at pm.org
[mailto:miltonkeynes-pm-bounces+tony.edwardson=commerzbank.com at pm.org] On
Behalf Of Gavin Westwood
Sent: Thursday, December 20, 2007 2:10 PM
To: miltonkeynes-pm at pm.org
Subject: Re: Coding Together

 

On 20/12/2007 10:33, Edwardson, Tony wrote: 

As discussed the other night, we probably want to check out the 4 modules to
see :-

*         What testing already exists

*         What the testing coverage is like

*         What needs to be done

*         How hard it is likely to be

 

Tom has volunteered to do this for Log::Dispatch, I'll investigate
Apache2::AuthCookieDBI, so can I suggest that Olie looks at
Perl::Metrics::Simple and Peter looks at ExtUtils::MakeMaker.


How about the three of us who are learning?  Should we each hook up with one
of yourselves?




A quick look at Apache2::AuthCookieDBI reveals a very complicated test suite
as follows :-

 

BEGIN { $| = 1; print "1..1\n"; }

END {print "not ok 1\n" unless $loaded;}

# use Apache::AuthCookieDBI; # commented; can't really run this without
Apache

$loaded = 1;

print "ok 1\n";

 

and that is it !


Ok, I don't get the first line, and the second one looks out of place (but a
quick google confirmed what I thought that it would get run at the end of
the procedure), but from what I can see this will always print "ok 1"?

Gavin



********************************************************************** 
This is a commercial communication from Commerzbank AG.

This communication is confidential and is intended only for the person to
whom it is addressed.  If you are not that person you are not permitted to
make use of the information and you are requested to notify
<mailto:LONIB.Postmaster at commerzbankib.com> immediately that you have
received it and then destroy the copy in your possession.

Commerzbank AG may monitor outgoing and incoming e-mails. By replying to
this e-mail you consent to such monitoring. This e-mail message and any
attached files have been scanned for the presence of computer viruses.
However, you are advised that you open attachments at your own risk.

This email was sent either by Commerzbank AG, London Branch, or by
Commerzbank Corporates & Markets, a division of Commerzbank. Commerzbank AG
is a limited liability company incorporated in the Federal Republic of
Germany. Registered Company Number in England BR001025. Our registered
address in the UK is 60 Gracechurch Street, London, EC3V 0HR. We are
regulated by the Financial Services Authority for the conduct of investment
business in the UK and we appear on the FSA register under number 124920. 

**********************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20071220/d3ae0bae/attachment.html 


More information about the MiltonKeynes-pm mailing list