Subject: | Multiple group subscribe is broken |
in the state 'subscribe', the join logic assumes that Spread::join can
handle an arrayrefs of multiple group names to join to... however the
function has logic to deref a singleton [ $group ].
unfortunately, Spread::join resolves to the XS function GC_join which
has this declaration:
SV *
GC_join(svmbox, group_name)
SV * svmbox
char *group_name
so, attempts to join multiple groups, by supplying a (documented)
arrayref of group names, causes a SINGLE join to the group
'ARRAY(0x98084a0)', the stringified reference.
Near line 316 of Component/SpreadClient.pm, the code reads:
my $rtn;
eval {
$rtn = Spread::join( $_[HEAP]->{'MBOX'}, $groups );
};
After reading the Spread.pm docs, I fixed it by changing this to:
my @rtn;
eval {
@rtn = grep (Spread::join( $_[HEAP]->{'MBOX'}, $_ ), ref $groups ?
@$groups : $groups);
};
(the funky grep came from the Spread.pm pod... it returns the list of
those groups that were successfully subscribed)
This is *not* a complete fix:
The "de-ref" logic near line 301 should be removed.
Error checking should be adjusted to ensure that @rtn == @$groups
However, the listed fix makes my code work.