Hi,
When I write a CGI script in perl I seem to get this line printed out
TWICE !
Content-Type: text/html; charset=iso-8859-1
It also shows up in the web browser as the first line, when I execute
the same from my cgi-bin
dir.
Any idea how I may get rid of this duplication ? It could be causing
problems while
I debug and run my programs..
Thanks:)
Re: how to remove duplicate header line in CGI
am 18.09.2007 00:10:53 von xhoster
dmedhora@gmail.com wrote:
> Hi,
> When I write a CGI script in perl I seem to get this line printed out
> TWICE !
>
> Content-Type: text/html; charset=iso-8859-1
>
> It also shows up in the web browser as the first line, when I execute
> the same from my cgi-bin
> dir.
>
> Any idea how I may get rid of this duplication ?
Figure out which part of your code is printing both of these, and take out
whichever part it makes the most sense to take out.
You could try to tie STDOUT to something that will filter out
a second header, but at that point you pretty much have to face
the fact that the code is now in control of you and not the other
way around. Time to start working on a fundamental re-design.
If you use fatalsToBrowser then a fatal error might cause an extra header
to be printed if one has already been printed. This has never caused
me a problem, so I just live with it. It tries to guess if you have
already printed a header, but I believe the way it does this, and
the effectiveness of it, changes from version to version.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
Re: how to remove duplicate header line in CGI
am 18.09.2007 03:00:57 von Petr Vileta
dmedhora@gmail.com wrote:
> Hi,
> When I write a CGI script in perl I seem to get this line printed out
> TWICE !
>
> Content-Type: text/html; charset=iso-8859-1
>
> It also shows up in the web browser as the first line, when I execute
> the same from my cgi-bin
> dir.
>
> Any idea how I may get rid of this duplication ? It could be causing
> problems while
> I debug and run my programs..
>
Maybe this can be a problem in web server configuration. If your server is
configured to "auto-send" this header line then you need not to send the
same from your script. But better is reconfigure server to "auto-send" no
headers and generate all headers in your scripts.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Re: how to remove duplicate header line in CGI
am 18.09.2007 04:03:24 von Tad McClellan
dmedhora@gmail.com wrote:
> When I write a CGI script in perl I seem to get this line printed out
> TWICE !
>
> Content-Type: text/html; charset=iso-8859-1
> Any idea how I may get rid of this duplication ?
Yes. Find the 2 places in your code that are outputting that header,
and remove one of them.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
Re: how to remove duplicate header line in CGI
am 18.09.2007 08:53:58 von benkasminbullock
On Mon, 17 Sep 2007 13:25:11 -0700, dmedhora wrote:
> Hi,
> When I write a CGI script in perl I seem to get this line printed out
> TWICE !
>
> Content-Type: text/html; charset=iso-8859-1
If I try this:
#!/usr/bin/perl
use warnings;use strict;
use CGI;
my $nice_cgi=CGI::new();
print $nice_cgi->header();
I just get it once.
> It also shows up in the web browser as the first line, when I execute
> the same from my cgi-bin
> dir.
>
> Any idea how I may get rid of this duplication ?
It's really, really hard to say why the duplication is occurring without
looking at your script. Perhaps you have something like this, for example:
would also suffice to create this computational conundrum.
> It could be causing
> problems while
> I debug and run my programs..
Re: how to remove duplicate header line in CGI
am 18.09.2007 15:24:37 von dmedhora
On Sep 17, 9:25 pm, dmedh...@gmail.com wrote:
> Hi,
> When I write a CGI script in perl I seem to get this line printed out
> TWICE !
>
> Content-Type: text/html; charset=iso-8859-1
>
> It also shows up in the web browser as the first line, when I execute
> the same from my cgi-bin
> dir.
>
> Any idea how I may get rid of this duplication ? It could be causing
> problems while
> I debug and run my programs..
>
> Thanks:)
Hi and Thanks for your posts, Well, to add more details to this
It happens only when I use CGI::FormBuilder
So, if I use CGI.pm there is no duplication but if I use
CGI::FormBuilder then I get that duplicate.
Here is some code :)
==========================================================
#!/usr/bin/perl
Note, since I got this problem I've dumped FormBuilder and
settled for plain CGI.pm instead.
Re: how to remove duplicate header line in CGI
am 18.09.2007 15:40:55 von benkasminbullock
On Tue, 18 Sep 2007 06:24:37 -0700, dmedhora wrote:
> Hi and Thanks for your posts, Well, to add more details to this
> It happens only when I use CGI::FormBuilder
> So, if I use CGI.pm there is no duplication but if I use
> CGI::FormBuilder then I get that duplicate.
I ran the script you supplied, but I only got the offending message once.
Re: how to remove duplicate header line in CGI
am 18.09.2007 17:41:28 von paduille.4061.mumia.w+nospam
On 09/18/2007 08:40 AM, Ben Bullock wrote:
> On Tue, 18 Sep 2007 06:24:37 -0700, dmedhora wrote:
>
>> Hi and Thanks for your posts, Well, to add more details to this
>> It happens only when I use CGI::FormBuilder
>> So, if I use CGI.pm there is no duplication but if I use
>> CGI::FormBuilder then I get that duplicate.
>
> I ran the script you supplied, but I only got the offending message once.
Same here.
Re: how to remove duplicate header line in CGI
am 19.09.2007 15:46:05 von dmedhora
On Sep 18, 4:41 pm, "Mumia W."
+nos...@earthlink.net> wrote:
> On 09/18/2007 08:40 AM, Ben Bullock wrote:
>
> > On Tue, 18 Sep 2007 06:24:37 -0700, dmedhora wrote:
>
> >> Hi and Thanks for your posts, Well, to add more details to this
> >> It happens only when I use CGI::FormBuilder
> >> So, if I use CGI.pm there is no duplication but if I use
> >> CGI::FormBuilder then I get that duplicate.
>
> > I ran the script you supplied, but I only got the offending message once.
>
> Same here.
Hi,
Well when I run the script on the command line I get two headers i.e
"Content Type" lines
printed out, is that good or bad ?
I have a cat and head display below:
[root@localhost cgi-bin]# cat h.pl
#!/usr/bin/perl
use CGI::FormBuilder;
It might be a bug in your version of CGI::FormBuilder. I'm using the
latest version, including dependencies. One suggestion which might fix
this is you could try using "cpan upgrade" to make sure that you're up to
date with all the modules you're using. Also it might be a good idea to
try running the same script on a different machine.
Re: how to remove duplicate header line in CGI
am 19.09.2007 19:50:09 von paduille.4061.mumia.w+nospam
On 09/19/2007 08:46 AM, dmedhora@gmail.com wrote:
>
> Hi,
> Well when I run the script on the command line I get two headers i.e
> "Content Type" lines
> printed out, is that good or bad ? [...]
As Mr. Morrow said, that's bad.
When I run the following script on the command line, I get only one
Content-Type header:
On Sep 19, 6:50 pm, "Mumia W."
+nos...@earthlink.net> wrote:
> On 09/19/2007 08:46 AM, dmedh...@gmail.com wrote:
>
>
>
> > Hi,
> > Well when I run the script on the command line I get two headers i.e
> > "Content Type" lines
> > printed out, is that good or bad ? [...]
>
> As Mr. Morrow said, that's bad.
>
> When I run the following script on the command line, I get only one
> Content-Type header:
>
> ----------------------script------------------
> #!/usr/bin/perl
>
> use CGI::FormBuilder;
> use Module::Versions::Report;
>
> my @fields = qw(category task status notes);
>
> my $form = CGI::FormBuilder->new(
> method => 'post',
> fields => \@fields,
> validate => {
> status => 'INT', # validate
> },
> required => 'ALL',
> );
>
> if ($form->submitted)
> {
> print $form->confirm(header => 1);} else {
>
> print $form->render(header => 1);}
>
> ----------------------end---------------------
>
> Here is the output:
>
> Content-Type: text/html; charset=ISO-8859-1
>
>
Guys!, I upgraded to 3.0501 as you suggested and voila
its fine! Damn, did I waste a lotta time on this one,
Thanks for your help. I Wonder why I didn't think an
upgrade would help in the first place...:)
Now, the question is ( and u don't have to answer this :)
Do I go the CGI::FormBuilder route or CGI.pm + Javascript
route ? Any ideas on which one is more "your" choice ?
Thanks again!