Skip Menu |

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

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

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

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



Subject: Calling create method over POE::Session::AttributeBased
POE::Session::AttributeBased doesn't have a create method. Changing it to POE::Session it compiles. But still don't get the module to work :-(
The following patch solve the problem reported in ticket #28442. And also this one. BTW it also removed the ^M. (dos2unix-fromdos).
--- SpreadClient.pm 2007-09-15 21:42:57.000000000 +0400 +++ SpreadClient.pm.new 2007-09-15 21:39:16.000000000 +0400 @@ -15,48 +15,49 @@ use POE::Filter::SpreadClient; use Spread qw( :MESS :ERROR ); -# Other miscellaneous modules we need +# Other miscellaneous modules we need use Carp; # Generate our states! use base 'POE::Session::AttributeBased'; -# Set some constants -BEGIN { - # Debug fun! - if ( ! defined &DEBUG ) { - eval "sub DEBUG () { 0 }"; - } +# Set some constants +BEGIN { + # Debug fun! + if ( ! defined &DEBUG ) { + eval "sub DEBUG () { 0 }"; + } } # Create our instance! sub spawn { - # Get the OOP's type - my $type = shift; - - # Our own options - my $ALIAS = shift; - - # Get the session alias - if ( ! defined $ALIAS ) { - # Debugging info... - if ( DEBUG ) { - warn 'Using default ALIAS = SpreadClient'; - } - - # Set the default - $ALIAS = 'SpreadClient'; + # Get the OOP's type + my $type = shift; + + # Our own options + my $ALIAS = shift; + + # Get the session alias + if ( ! defined $ALIAS ) { + # Debugging info... + if ( DEBUG ) { + warn 'Using default ALIAS = SpreadClient'; + } + + # Set the default + $ALIAS = 'SpreadClient'; } # Okay, create our session! - POE::Session::AttributeBased->create( + POE::Session->create( + POE::Component::SpreadClient->inline_states(), 'heap' => { 'ALIAS' => $ALIAS, }, ) or croak; } -sub _start : state { +sub _start : State { # Debugging if ( DEBUG ) { warn "SpreadClient was started!"; @@ -68,7 +69,7 @@ } } -sub _stop : state { +sub _stop : State { # Debugging if ( DEBUG ) { warn "SpreadClient was stopped!"; @@ -78,7 +79,7 @@ $_[KERNEL]->call( $_[SESSION], 'disconnect' ); } -sub connect : state { +sub connect : State { # Server info, private name my( $server, $priv ) = @_[ ARG0, ARG1 ]; @@ -172,7 +173,7 @@ return; } -sub disconnect : state { +sub disconnect : State { # Sanity if ( exists $_[HEAP]->{'WHEEL'} and defined $_[HEAP]->{'WHEEL'} ) { # Debugging @@ -208,7 +209,7 @@ return; } -sub destroy : state { +sub destroy : State { # Okay, destroy ourself! $_[KERNEL]->call( $_[SESSION], 'disconnect' ); @@ -219,7 +220,7 @@ return; } -sub publish : state { +sub publish : State { my( $groups, $message, $mess_type, $flag ) = @_[ ARG0 .. ARG3 ]; # Shortcut @@ -279,7 +280,7 @@ return; } -sub subscribe : state { +sub subscribe : State { # The groups to join my $groups = $_[ARG0]; @@ -335,7 +336,7 @@ return; } -sub unsubscribe : state { +sub unsubscribe : State { # The groups to unsub my $groups = $_[ARG0]; @@ -387,7 +388,7 @@ } # Registers interest in the client -sub register : state { +sub register : State { # Automatically add the sender session to listeners if ( ! exists $_[HEAP]->{'LISTEN'}->{ $_[SENDER]->ID } ) { $_[HEAP]->{'LISTEN'}->{ $_[SENDER]->ID } = 1; @@ -398,7 +399,7 @@ } # Unregisters interest in the client -sub unregister : state { +sub unregister : State { # Automatically add the sender session to listeners if ( exists $_[HEAP]->{'LISTEN'}->{ $_[SENDER]->ID } ) { delete $_[HEAP]->{'LISTEN'}->{ $_[SENDER]->ID }; @@ -408,7 +409,7 @@ return; } -sub RW_Error : state { +sub RW_Error : State { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; @@ -421,7 +422,7 @@ $_[KERNEL]->call( $_[SESSION], 'disconnect' ); } -sub RW_GotPacket : state { +sub RW_GotPacket : State { my( $type, $sender, $groups, $mess_type, $endian, $message ) = @{ @{ $_[ARG0] }[0] }; # Check for disconnect @@ -646,21 +647,21 @@ =head2 C<_sp_connect> - sub _sp_connect : state { + sub _sp_connect : State { my( $priv_name, $priv_group ) = @_[ ARG0, ARG1 ]; # We're connected! } =head2 C<_sp_disconnect> - sub _sp_disconnect : state { + sub _sp_disconnect : State { my $priv_name = $_[ ARG0 ]; # We're disconnected! } =head2 C<_sp_error> - sub _sp_error : state { + sub _sp_error : State { my( $priv_name, $type, $sperrno, $msg, $data ) = @_[ ARG0 .. ARG4 ]; # Handle different kinds of errors @@ -679,7 +680,7 @@ =head2 C<_sp_message> - sub _sp_message : state { + sub _sp_message : State { my( $priv_name, $sender, $groups, $mess_type, $message ) = @_[ ARG0 .. ARG4 ]; # $mess_type is always 0 unless defined ( mess_type in Spread ) @@ -687,7 +688,7 @@ =head2 C<_sp_admin> - sub _sp_admin : state { + sub _sp_admin : State { my( $priv_name, $data ) = @_[ ARG0, ARG1 ]; # $data is hashref with several fields: # TYPE => string ( JOIN | LEAVE | DISCONNECT | SELF_LEAVE | TRANSITIONAL | NETWORK ) @@ -711,20 +712,20 @@ # GROUP, MEMBERS, GID, INDEX, MESSAGE } -=head1 SpreadClient Notes - -You can enable debugging mode by doing this: - - sub POE::Component::SpreadClient::DEBUG () { 1 } - use POE::Component::SpreadClient; +=head1 SpreadClient Notes + +You can enable debugging mode by doing this: + + sub POE::Component::SpreadClient::DEBUG () { 1 } + use POE::Component::SpreadClient; =head1 BUGS - Need to be tested more! - Endian mis-match is simply a warn, should it be added to _sp_message ? -=head1 SEE ALSO - +=head1 SEE ALSO + L<Spread> L<Spread::Message> @@ -736,11 +737,11 @@ The base for this module was lifted from POE::Component::Spread by Rob Partington <perl-pcs@frottage.org>. -=head1 COPYRIGHT AND LICENSE - -Copyright 2006 by Apocalypse - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut +=head1 COPYRIGHT AND LICENSE + +Copyright 2006 by Apocalypse + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut
applied in 0.05, thanks again! P.S. sorry for the lag, I lost my emails and finally checked out my rt.cpan.org login ;) -- ~Apocalypse