in reply to Re^3: How to store an array in the store of Bot::BasicBot::Pluggable::Module?
in thread How to store an array in the store of Bot::BasicBot::Pluggable::Module?
Boy, was I stupid... Thank you! It works now with the following snippet:
if ( $body =~ /^!setq\s*$/ ) { my @order = ("orange","peach","banana"); $self->set("fruit_order"=>\@order); my $o= $self->get("fruit_order"); my $ou= "order: ".join(", ",@$o); return $ou if (ref $o eq 'ARRAY'); return "no order :("; }
Why it didn't work before, you ask? Well, if you look closely you'll find that I tried to use return with an array. It will not dump the contents of the array into the channel though but expects a scalar (so it sent a 0 for an empty array and a 3 for the above example). I had to use string concatenation and a helper variable first to get return to paste the contents of the array.
Works now, thanks again!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to store an array in the store of Bot::BasicBot::Pluggable::Module?
by jethro (Monsignor) on Jan 22, 2011 at 17:34 UTC | |
by brengo (Acolyte) on Jan 23, 2011 at 02:22 UTC |