Subject: | Sleeve of "Use of unitialized value" warnings |
I've stepped in one, namely in SetIQCallBacks(). Then I've checked all LogX() invocations.
Subject: | uouv-sleeve.diff |
diff -uNr backup-1.002004/lib/Net/XMPP/Protocol.pm uouv-sleeve/lib/Net/XMPP/Protocol.pm
--- backup-1.002004/lib/Net/XMPP/Protocol.pm 2011-07-19 19:58:40.000000000 +0300
+++ uouv-sleeve/lib/Net/XMPP/Protocol.pm 2012-02-06 20:27:54.000000000 +0200
@@ -1321,13 +1321,14 @@
{
my $func = pop(@_);
my $tag = pop(@_);
- $self->{DEBUG}->Log1("SetCallBacks: tag($tag) func($func)");
if (defined($func))
{
+ $self->{DEBUG}->Log1("SetCallBacks: tag($tag) func($func)");
$self->{CB}->{$tag} = $func;
}
else
{
+ $self->{DEBUG}->Log1("SetCallBacks: tag($tag) func(undef)");
delete($self->{CB}->{$tag});
}
$self->{STREAM}->SetCallBacks(update=>$func) if ($tag eq "update");
@@ -1351,14 +1352,16 @@
foreach my $type (keys(%{$hash}))
{
- $self->{DEBUG}->Log1("SetIQCallBacks: type($type) func($hash->{$type}) ".
- "namespace($namespace)");
if (defined($hash->{$type}))
{
+ $self->{DEBUG}->Log1("SetIQCallBacks: type($type) ".
+ "func($hash->{$type}) namespace($namespace)");
$self->{CB}->{IQns}->{$namespace}->{$type} = $hash->{$type};
}
else
{
+ $self->{DEBUG}->Log1("SetIQCallBacks: type($type) ".
+ "func(undef) namespace($namespace)");
delete($self->{CB}->{IQns}->{$namespace}->{$type});
}
}
@@ -1378,14 +1381,15 @@
foreach my $type (keys(%types))
{
- $self->{DEBUG}->Log1("SetPresenceCallBacks: type($type) func($types{$type})");
-
if (defined($types{$type}))
{
+ $self->{DEBUG}->Log1("SetPresenceCallBacks: type($type) ".
+ "func($types{$type})");
$self->{CB}->{Pres}->{$type} = $types{$type};
}
else
{
+ $self->{DEBUG}->Log1("SetPresenceCallBacks: type($type) func(undef)");
delete($self->{CB}->{Pres}->{$type});
}
}
@@ -1404,14 +1408,15 @@
foreach my $type (keys(%types))
{
- $self->{DEBUG}->Log1("SetMessageCallBacks: type($type) func($types{$type})");
-
if (defined($types{$type}))
{
+ $self->{DEBUG}->Log1("SetMessageCallBacks: type($type) ".
+ "func($types{$type})");
$self->{CB}->{Mess}->{$type} = $types{$type};
}
else
{
+ $self->{DEBUG}->Log1("SetMessageCallBacks: type($type) func(undef)");
delete($self->{CB}->{Mess}->{$type});
}
}
@@ -1430,6 +1435,7 @@
foreach my $xpath (keys(%xpaths))
{
+# XXX Hopefully, no-one sets callback to undef here, those ignorant should use RemoveXPathCallBacks instead.
$self->{DEBUG}->Log1("SetXPathCallBacks: xpath($xpath) func($xpaths{$xpath})");
$self->{CB}->{XPath}->{$xpath}->{$xpaths{$xpath}} = $xpaths{$xpath};
}