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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


New User

Jan 2, 2013, 5:31 AM

Post #1 of 3 (4141 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:

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

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

This is the script:

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 => "",
hostname => "localhost",
password => "123458765",
resource => "Blubb"

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

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

I am grateful for any help.

Veteran / Moderator

Jan 2, 2013, 6:44 AM

Post #2 of 3 (4137 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.

New User

Jan 2, 2013, 11:10 PM

Post #3 of 3 (4117 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:

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

Best regards


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

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