please keep discussions on list so that everyone can benefit :) Dermot Paikkos wrote: > Thanx Geoffrey, > > You probably noticed - due to my lack of real perl know-how - that I > scooped a lot of that code from your book so another thanx.
sure thing :) > > Its works, problem is I am not sure why (doh). > > $~ = "CLOCK" makes sense now I know what $~ stands for. > > Why store and select $fh in $ofh? Couldn't I just select($fh) and > write? That seems to work to. well, by doing select($fh) you are setting the the default output filehandle to $fh - STDOUT is returned. it is just proper manners to STDOUT back as to not collide with anyone else who depends on STDOUT. for instance, without setting it back print() statements will go to $fh instead of STDOUT. > > One of the reasons I was creating a $tmpfile was so the user could > download a text document that would be "printer friendly", ie: A4 > paper size. It is difficult to send a series of files to a html page > and know that each file's contents will print out on an individual > page but setting $= = 70 should do the trick. I still don't understand why you would need $tempfile for that (as opposed to $fh which is open to the temporary file). maybe my advice was confusing - I meant to say that it is best to pretend you don't know the _name_ of the temporary file as to avoid possible race conditions and other such foo. see the File::Temp documentation which IIRC has some explantions around why. > > Question is how to send the file. If send_http_header('text') is set > the user is asked to save or open a file but the file is empty. Do > you know how I get around this? 'text' is not really the proper content type - 'text/plain' is really what you want. if that doesn't work then see recipe 5.6. HTH --Geoff -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html