develooper Front page | perl.perl5.porters | Postings from April 2007

Re: got Smack(ed) lately?

Thread Previous | Thread Next
From:
Joshua ben Jore
Date:
April 17, 2007 23:19
Subject:
Re: got Smack(ed) lately?
Message ID:
dc5c751d0704172319j41de31e0s45192d5cc33d1b38@mail.gmail.com
On 4/17/07, Tom Christiansen <tchrist@perl.com> wrote:
> =for your consideration,
>
> The surrounding module, Smack.pm, runs perfectly well, as demonstrated by
>
>     % perl -MSmack -e 'smack && snarf && print "hurray!\n" '
>
> after clipping this message body and placing it in the obviously-named
> file: the expected "hurray!" is indeed correctly emitted.  But it is
> a false cheer, for this innocent module nevertheless has a bug or two
> lurking in it.
>
> Can you* see the problem?  If so, is it really glaringly obvious to
> everyone but me?  Has awareness of this niggling nasty passed into
> general understanding?

I wish I could spot the problem. I can't. What is it?

I don't like that it exports things by default. I don't see why you're
using a global filehandle instead of a lexical one. You aren't
checking for success on your two writes (though I admit it probably
wouldn't matter til the close()).

You're handling $/, $\, and $_ sanely. You're ensuring that you're
writing "bytes" to the files even under the possible effect of the -C
runtime parameter.

So... I suppose you're not checking for an error during your readline
loop over BINDATA. Surely that's not it. I've only ever seen one
person attempt to check for errors from that.

Josh

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About