You should get a SIG PIPE either when the user hits stop or when you try and output and the user has previously hit stop. So this should be trappable if you are not inside mod_perl.
Unbuffering your output $| =1; may make this more time sensitive.
-monkfish (The Fishy Monk)