Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

client module

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
in the jabber protocol module of Net::Jabber::Protocol, there is a basic function called SetCallBacks, i cannot follow it properly. can anyone tell me what it means. Also is there any book or tutorial where i could understand all these functions easily.

thanks
namomita
 
[tt]
sub SetCallBacks {
shift;
my $self = shift;
while($#) >= 0) {
my $func = pop(@_);
my $tag = pop(@_);
$self->{DEBUG}->Log1("SetCallBacks: tag($tag) func($func)");
$self->{CB}{$tag} = $func;
$self->{STREAM}->SetCallBacks(update=>$func) if ($tag eq "update");
}
}
[/tt]
and then later:[tt]
sub SendXML {
shift;
my $self = shift;
my $xml = shift;
$self->{DEBUG}->Log1("SendXML: sent($xml)");
&{$self->{CB}->{send}}($self->{SESSION}->{id},$xml) if exists($self->{CV}->{send});
$self->{STREAM}->Send($self->{SESSION}->{id},$xml);
}[/tt]

so $self->{CB} is a hash of function names and functions that will be called if they exist at certain times througout the execution of your program. SetCallBacks is what you use to set those functions...
does that explain enough?
stillflame "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top