Simple send perl plugin

mowsen mowsen at
Mon Sep 21 09:53:33 EDT 2009

Hey there.

I want to send a simple message via a perl plugin using finch on the
console. Basically, i try using the code from the perl tutorial -
without any luck. The code looks like this:

use Purple;
    perl_api_version => 2,
    name => "Perl Test Plugin",
    version => "0.1",
    summary => "Test plugin for the Perl interpreter.",
    description => "Your description here",
    author => "John H. Kelm <johnhkelm\",
    url => "",
    load => "plugin_load",
    unload => "plugin_unload"

sub plugin_init {
    return %PLUGIN_INFO;

sub plugin_unload {
    my $plugin = shift;
    Purple::Debug::info("testplugin", "plugin_unload() - Test Plugin

sub plugin_load {
    my $plugin = shift;
    my $protocol = "prpl-oscar";
    my $account_name = "mowsen1212";

    $account = Purple::Accounts::find($account_name, $protocol);

    print "Testing Purple::Conversation->new()...";
    $conv1 = Purple::Conversation->new(1, $account, "Test Conversation 1");
    if ($conv1) { print "ok.\n"; } else { print "fail.\n"; }

    print "Testing Purple::Conversation::get_im_data()...\n";
    $im = $conv1->get_im_data();
    if ($im) { print "ok.\n"; } else { print "fail.\n"; }

    print "Testing Purple::Conversation::IM::send()...\n";
    $im->send("Message Test.");

In the debug console i get:

g_log: purple_conversation_new: assertion `account != NULL' failed

perl: Perl function Purple::Script::test::plugin_load exited
abnormally: Can't call method "get_im_data" on an undefined value at
(eval 5) line 35.

Anyone a clue what's wrong here. And btw. where the heck do i enter
the receiver? (I somewhere read i must replace the third argument of
the conversation statement to the receivers screen name - but that
still gave the same error)


More information about the Devel mailing list