Subject: | "Use of uninitialized value" warning in as_string() |
I have some code which, somehow, ends up undef values in the headers of
a frame. This then triggers many "Use of uninitialized value" warnings,
emitted from the following code in as_string()
while ( my ( $key, $value ) = each %{ $headers || {} } ) {
$frame .= $key . ':' . $value . "\n";
}
I note that $headers dumps like so:
$VAR1 = {
'message-id' => undef
};
Perhaps the code above should look like this instead?
while ( my ( $key, $value ) = each %{ $headers || {} } ) {
$frame .= $key . ':' . (defined $value ? $value : '') . "\n";
}