CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Can't locate method "push_write"

 



tobi
New User

Jan 2, 2013, 5:31 AM

Post #1 of 3 (1095 views)
Can't locate method "push_write" Can't Post

Hi there!

I'm trying to send a message via XMPP, but I only get the error:

Code
Can't locate object method "push_write" via package "AnyEvent::Util::guard" at /usr/local/share/perl/5.14.2/AnyEvent/XMPP/SimpleConnection.pm line 113.

All needed modules are installed and I don't know what's wrong here.

This is the script:

Code
#!/usr/bin/perl 
use utf8;
use AnyEvent;
use AnyEvent::XMPP::IM::Connection;
use AnyEvent::XMPP::IM::Presence;
use AnyEvent::XMPP::Util qw/split_jid/;

my $con =
AnyEvent::XMPP::Connection->new (
username => "root",
domain => "perlx.de",
hostname => "localhost",
password => "123458765",
resource => "Blubb"
);

$con->reg_cb (stream_ready => sub { print "bereit!\n" });
$con->connect;


AnyEvent::XMPP::IM::Message->new (
body => "test",
to => "tk@perlx.de"
)->send ($con);


I am grateful for any help.
Regards,
Tobi


FishMonger
Veteran / Moderator

Jan 2, 2013, 6:44 AM

Post #2 of 3 (1091 views)
Re: [tobi] Can't locate method "push_write" [In reply to] Can't Post

Are you sure all needed modules are installed and were installed without errors?

The "push_write" method is defined in the AnyEvent::Handle module. I have not looked at each of the modules you are loading to see which one, if any, load that module, but start by adding it to your list of use statements.

You should also add the warnings and strict pragmas, which should be in every script you write.


tobi
New User

Jan 2, 2013, 11:10 PM

Post #3 of 3 (1071 views)
Re: [FishMonger] Can't locate method "push_write" [In reply to] Can't Post

Thank's for your reply FishMonger!

Modues where all installed with "make test -- OK" and "make install -- OK".

Actualy it didn't run because I'm too soopid:
I invoked send() after reg_cb() was finished.
Instead, this works for me:

Code
 $con->reg_cb ( 
...
AnyEvent::XMPP::IM::Message->new (
...
)->send ($con);
);

Best regards
Tobi

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives