Skip Menu |
 

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 57314
Status: rejected
Priority: 0/
Queue: POE

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

Bug Information
Severity: Wishlist
Broken in: 1.289
Fixed in: (no value)



Subject: Alias as argument to refcount_{in,de}crement does not change refcount
Download (untitled) / with headers
text/plain 374b
In 1.289 refcount_{in,de}crement documentation says it only allows session IDs as arguments. Alias are accepted too by the implementation, but the refcount of the session does not seem to be incremented. This seems to be an inconsistency in the support for alias as sessions IDs in the POE API. For a use case, see RT#56447. -- Olivier Mengué - http://o.mengue.free.fr/
Subject: Alias as argument to refcount_increment does not change refcount
Download (untitled) / with headers
text/plain 302b
An alias should either: - be rejected with ESRCH - be accepted and the refcount changed The current code accepts the alias, but does not increment the refcount. The fix is probably to use $self->_resolve_session() instead of $self->_data_sid_resolve() -- Olivier Mengué - http://o.mengue.free.fr/
Here is a testcase. -- Olivier Mengué - http://o.mengue.free.fr/
Subject: refcnt-alias.t
Download refcnt-alias.t
text/x-perl 550b
#!/usr/bin/perl use strict; use warnings; use POE; use Test::More tests => 4; POE::Session->create( inline_states => { _start => sub { my $k = $_[KERNEL]; my $s = $_[SESSION]; is($k->refcount_increment($s->ID, 'Test'), 1, "Inc by ID"); is($k->refcount_decrement($s->ID, 'Test'), 0, "Dec by ID"); my $alias = 'MyAlias'; $k->alias_set($alias); is($k->refcount_increment($alias, 'Test'), 1, "Inc by alias"); is($k->refcount_decrement($alias, 'Test'), 0, "Dec by alias"); } }, ); POE::Kernel->run();
Download (untitled) / with headers
text/plain 429b
It appears that the methods work as documented. The methods return undef, and $! is set to ESRCH when these methods fail. I have updated the documentation slightly to be clearer about the return values. % perl -wle 'use POE; $!=0; print $! unless $poe_kernel->refcount_increment("whee", "au");' No such process % perl -wle 'use POE; $!=0; print $! unless $poe_kernel->refcount_decrement("whee", "au");' No such process
Download (untitled) / with headers
text/plain 581b
Le Lun 26 Jui 2010 23:09:21, RCAPUTO a écrit : Show quoted text
> It appears that the methods work as documented. The methods return > undef, and $! is set to ESRCH when these methods fail.
This is not the subject of this bug. Could you have a look at the whole history? This bug is about aliases handling. The documentation says nothing about giving an alias name as the first argument of refcount_ methods. And I suggest that an alias should be accepted and resolved for consistency as alias are usually accepted where session ID are accepted. -- Olivier Mengué - http://o.mengue.free.fr/
Download (untitled) / with headers
text/plain 907b
On Sun Aug 01 17:56:13 2010, DOLMEN wrote: Show quoted text
> Le Lun 26 Jui 2010 23:09:21, RCAPUTO a écrit :
> > It appears that the methods work as documented. The methods return > > undef, and $! is set to ESRCH when these methods fail.
> > This is not the subject of this bug. Could you have a look at the
whole history? I read the entire ticket. Show quoted text
> The documentation says nothing about giving an alias name as the first
argument of refcount_ methods. Yes. The documentation is correct. The methods don't accept aliases. Show quoted text
> And I suggest that an alias should be accepted and resolved for
consistency as alias are usually accepted where session ID are accepted. The consistency isn't worth the additional overhead this would incur for all users, most of whom don't need it. You can look up the session ID yourself, adding overhead for your specific use case without penalizing everyone else for your convenience.
Download (untitled) / with headers
text/plain 591b
Le Dim 01 Aoû 2010 19:13:18, RCAPUTO a écrit : Show quoted text
> I read the entire ticket.
Thank you for your answer. I'm sorry for the misunderstanding. I have now understood that my testcase was not checking the right thing. Show quoted text
> The consistency isn't worth the additional overhead this would incur for > all users, most of whom don't need it. You can look up the session ID > yourself, adding overhead for your specific use case without penalizing > everyone else for your convenience.
I understand the rationale. Thank you for your great work on POE. -- Olivier Mengué - http://o.mengue.free.fr/


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.