[Pidgin] #10641: perl add_choice adds same choices within a loop
Pidgin
trac at pidgin.im
Sun Apr 25 14:48:09 EDT 2010
#10641: perl add_choice adds same choices within a loop
--------------------+-------------------------------------------------------
Reporter: rlazur | Owner: deryni
Type: defect | Status: new
Milestone: | Component: plugins
Version: 2.6.3 | Resolution:
Keywords: perl |
--------------------+-------------------------------------------------------
Comment(by FreeElla):
I run with version 2.6.6 and the same here.
See my attached sample below that has no regex.
I also tried to force copy of variables using 'my $newVar =
sprintf("%s",$oldvar);' but the result is still the same.
And yes, some times I don't see the last value of the loop but even some
text that it is from inside my perl script. So this might be a pointer
issue.
{{{
my @accounts_all = ('test_a','test_b','test_c','test_d','test_e');
my $myppref = Purple::PluginPref->new_with_name_and_label(
"${plugin_pref_ctx}/chatUsersSender","Sending user");
$myppref->set_type(1);
#FIXME: The add_choice() always corrupts in a loop (for, while, goto) but
working fine when placing without loop.
# BUG
for(my $accCount = 0; $accCount <= $#accounts_all; $accCount++ ) {
$myppref->add_choice("$accounts_all[$accCount]
($accCount)","$accounts_all[$accCount]:PROTO:$accCount");
Purple::Debug::info($plugin_name, "prefs_info_cb() LOOP -
$accounts_all[$accCount] ($accCount) --
$accounts_all[$accCount]:PROTO:$accCount\n");
}
# Working
my $accCount = 0;
if(0 <= $#accounts_all) {
$myppref->add_choice("$accounts_all[$accCount]
($accCount)","$accounts_all[$accCount]:PROTO:$accCount");
Purple::Debug::info($plugin_name, "prefs_info_cb() NOLOOP -
$accounts_all[$accCount] ($accCount) --
$accounts_all[$accCount]:PROTO:$accCount\n");
}
$accCount = 1;
if(1 <= $#accounts_all) {
$myppref->add_choice("$accounts_all[$accCount]
($accCount)","$accounts_all[$accCount]:PROTO:$accCount");
Purple::Debug::info($plugin_name, "prefs_info_cb() NOLOOP -
$accounts_all[$accCount] ($accCount) --
$accounts_all[$accCount]:PROTO:$accCount\n");
}
...
}}}
--
Ticket URL: <http://developer.pidgin.im/ticket/10641#comment:5>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list