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

Re: got Smack(ed) lately?

Thread Previous | Thread Next
Joshua ben Jore
April 17, 2007 23:19
Re: got Smack(ed) lately?
Message ID:
On 4/17/07, Tom Christiansen <> wrote:
> =for your consideration,
> The surrounding module,, 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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About