I am new to Perl. Currently i doing some programming related to yahoo messenger on window platform. I got the latest activeperl 5.10. I would like to send and received message via yahoo messenger but i have problem when i run the perl script. And i also need to received attachment file. So i need some help to it. Anyway now the first thing is i can't connect to yahoo messenger. Please help me!!Thanks.
I got the following code: It is receiving message and i save the file as testing.pl
#!perl
use Net::YMSG;
use strict;
my $yahoo = Net::YMSG->new(
id => 'yahoo_id',
password => 'password',
pre_login_url => 'hostname => 'sc126.msg.sp1.yahoo.com',
);
$yahoo->set_event_handler(new ToStdoutEventHandler);
$yahoo->login or die "Can't login Yahoo!Messenger: $!"; # important: $! prints error message;
$yahoo->start;
package ToStdoutEventHandler;
use base 'Net::YMSG::EventHandler';
use strict;
sub ChangeState {}
sub GoesOffline {}
sub GoesOnline {}
sub UnImplementEvent {}
sub ReceiveMessage
{
my $self = shift;
my $event = shift;
printf "%s: %s\n", $event->from, $event->body;
}
__END__
When i run perl testing.pl in command prompt, it showed that unknown error at C:/Perl/site/lib/Net/YMSG.pm line 344.
sub get_connection
{
my $self = shift;
return $self->handle if $self->handle;
my $server = IO::Socket::INET->new( => this is line 344
PeerAddr => $self->{hostname},
PeerPort => $self->get_port,
Proto => 'tcp',
Timeout => 30,
) or die $!;
$server->autoflush(1);
return $self->handle($server);
}
Seriously need help. Thanks you.
I got the following code: It is receiving message and i save the file as testing.pl
#!perl
use Net::YMSG;
use strict;
my $yahoo = Net::YMSG->new(
id => 'yahoo_id',
password => 'password',
pre_login_url => 'hostname => 'sc126.msg.sp1.yahoo.com',
);
$yahoo->set_event_handler(new ToStdoutEventHandler);
$yahoo->login or die "Can't login Yahoo!Messenger: $!"; # important: $! prints error message;
$yahoo->start;
package ToStdoutEventHandler;
use base 'Net::YMSG::EventHandler';
use strict;
sub ChangeState {}
sub GoesOffline {}
sub GoesOnline {}
sub UnImplementEvent {}
sub ReceiveMessage
{
my $self = shift;
my $event = shift;
printf "%s: %s\n", $event->from, $event->body;
}
__END__
When i run perl testing.pl in command prompt, it showed that unknown error at C:/Perl/site/lib/Net/YMSG.pm line 344.
sub get_connection
{
my $self = shift;
return $self->handle if $self->handle;
my $server = IO::Socket::INET->new( => this is line 344
PeerAddr => $self->{hostname},
PeerPort => $self->get_port,
Proto => 'tcp',
Timeout => 30,
) or die $!;
$server->autoflush(1);
return $self->handle($server);
}
Seriously need help. Thanks you.