Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: Changing the content type

by psini (Deacon)
on Jul 15, 2008 at 20:24 UTC ( #697798=note: print w/replies, xml ) Need Help??

in reply to Re^2: Changing the content type
in thread Changing the content type

Thank you for the correction. I'll check tomorrow when I'm at office if (a) the above code is really the one I use and (b) if our script shows the same problem!

It is absolutely possible that we have put in production a program that duplicates the content-type and that Firefox accepts it without a warning using the first and discarding the second one.

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Replies are listed 'Best First'.
Re^4: Changing the content type
by friedo (Prior) on Jul 15, 2008 at 20:32 UTC
    To add to Fletch's (rather unnecessarily vociferous) correction, the right way to do it is to pass both arguments to header at the same time.
    print $q->header(-type => 'text/xml', -attachment => 'filename.xml');
    If you're using a framework like CGI::Application, there are utility methods for keeping track of multiple headers and outputting them exactly once, so you don't have to keep track of lots of print statements and won't accidentally print two sets of headers.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://697798]
[Eily]: I still don't understand how the Turkish AA fit into the German+Czech joke though :P
[LanX]: new Firefox + cb sidebar do random auto expand on submit
[LanX]: probably need to start pm discussion
[LanX]: they have a constitutional referendum in turkey, kind of "do you want a dictator" and everybody opting no gets problems ...
[Corion]: LanX: Random Auto Expand?
[Corion]: LanX: Well, everybody opting "yes" will also get problems. The question is more like "Do you want problems now or problems later?"

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-03-27 12:14 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.