Skip Menu |

This queue is for tickets about the POE-Component-SpreadClient CPAN distribution.

Report information
The Basics
Id: 38854
Status: resolved
Priority: 0/
Queue: POE-Component-SpreadClient

People
Owner: Nobody in particular
Requestors: rdb [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



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.
Hello, Sorry that it took me a while to get back to you! I've made the changes you suggested and did the extra tweaks you said I would need. Also, I noticed that unsubscribe is broken in the same way, so it was fixed too. I didn't like the funky grep semantics, so I simply fired off an event ( _sp_error ) if a particular group in an array failed. That way we have better debugging capability than assuming the entire array didn't succeed. PoCo-SpreadClient v0.07 is on it's way to CPAN now, and I hope you can let me know if it works for you too :) Thanks again for bringing this to my attention! -- ~Apocalypse