On Wed, 1 Oct 2003, Stas Bekman wrote:
> Randy Kobes wrote:
[ .. ]
> Cool. The following are just style comments.
>
> > + # test reading and writing text and binary files
> > + {
> > + local $/;
>
> Randy, can you please put local $/; just before it's
> needed? Otherwise it's too far away from its usage and it
> may affect other things if the test is expanded in the
> future. The best practice IMHO is:
>
> {
> local $/;
> ... <$fh>
> }
>
> in every place you need it. this makes the code easier to read.
Good idea - I'll do that ...
>
> > + my ($rfh, $wfh, $pfh);
>
> why these are defined outside and not where they are opened?
>
> open my $rfh, "<:APR", $in, $r->pool
>
> etc.
Done ...
>
> > + for my $file ('http.pod', 'http_cycle.png') {
> > + my $in = catfile $dir, $file;
> > + my $out = catfile $dir, "$file.out";
> > + open $rfh, "<:APR", $in, $r->pool
> > + or die "Cannot open $in for reading: $!";
> > + binmode($rfh); # not necessary
>
> if it's not necessary, why do we need it?
I'll drop the comment - it is too cryptic. But basically,
putting in a binmode($apr_fh) doesn't affect anything - you
can put it in, or leave it out, both for binary and text
files (even on Win32). Where having it in makes a difference
(but this doesn't matter to a user) is if PERLIO_K_RAW
was left out of apr_perlio.c. If it was, then all the
tests would pass without the binmode($apr_fh) calls, but
some will fail with a binmode($apr_fh).
[ .. ]
> I'd enclose the following code of its own block showing
> that it's an independent sub-test. you won't need to
> predeclare lexicals vars above. This practice makes easier
> to debug subtests where you can comment out blocks without
> affecting the rest of the test. see apr/pool.pm for such
> an example.
>
> > + my $scratch = catfile $dir, 'scratch.dat';
[ .. ]
I'll do that.
Thanks again, Stas.
--
best regards,
randy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]