[Catalyst] "Use of uninitialized value $buffer" error

Jesse Sheidlower jester at panix.com
Sat Jun 20 14:32:59 GMT 2009


I'm having a hell of a time trying to track down the reasons
for this error.

I'm getting an error that looks like:

Use of uninitialized value $buffer in concatenation (.) or
string at /usr/share/perl5/Catalyst/Engine/CGI.pm line 220.

If I'm using the HTTP.pm Engine, I get the same error, but
with a different line number; in both cases, it's the line
beginning with "$buffer" in the $self->write method, which
looks like this in CGI.pm:

---
around write => sub {
    my $orig = shift;
    my ( $self, $c, $buffer ) = @_;

    # Prepend the headers if they have not yet been sent
    if ( $self->_has_header_buf ) {
        $buffer = $self->_clear_header_buf . $buffer;
    }

    return $self->$orig( $c, $buffer );
};
---

I will say upfront that I don't know how to use the Perl
debugger.

I have tried a lot of way to isolate this, and just can't
figure out what's causing it. It does not happen on certain
requests; for example, if I deliberately enter an incorrect
password on a login page, I don't get it. But it happens on
almost all other requests; I don't see where in the
bogus-login cycle I might be avoiding something that could
short-circuit this. I've looked over my code fairly closely,
and I can't detect the pattern, or see anything that could be
causing this.

I should also note that this doesn't appear to have any effect
on my program; it "works" fine, I see all the pages, etc.

I'd be grateful if anyone could explain to me what might be
causing this, or where I can look to try to figure it out.

This is on Cat 5.80005 on Debian, with all modules up to date.

Thanks.

Jesse



More information about the Catalyst mailing list