http://www.perlmonks.org?node_id=996593


in reply to Debugging child pid 4577 exit signal Segmentation fault (11)

Hi, finally found the culprit. I cannot use the string concatenation on the header function, I think it has to do with the prototype thingy. This is the line that cause error.

return $cgi->header({-charset => "utf-8"}).$tmpl->output;

the header has to be assigned to a variable first then concatenate. I still wonder why ?

Thanks all.

  • Comment on Re: Debugging child pid 4577 exit signal Segmentation fault (11)

Replies are listed 'Best First'.
Re^2: Debugging child pid 4577 exit signal Segmentation fault (11)
by keenlearner (Acolyte) on Oct 01, 2012 at 07:47 UTC
    The final work around is putting the $cgi in the self.
    sub new { my ($class) = @_; my $self = {cgi => CGI->new}; bless $self, $class; return $self; }
      I still wonder why, I have been using the our $cgi = CGI->new for many modules, but only this particular module is having this issue. Any input will be great ?
Re^2: Debugging child pid 4577 exit signal Segmentation fault (11)
by keenlearner (Acolyte) on Oct 01, 2012 at 07:27 UTC
    Ops...sorry, this is still causing the problem. After I refresh more time, still got segmentation fault. But definitely is this $cgi->header, cause if don't use this object but use print "Content-type: text/html\n\n", it's no longer causing the segfault.