Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Work around session_pid_count() not working in 1.350 of POE

Reported as [rt.cpan.org #73393] by Gregor Herrmann of the Debian Perl Group
  • Loading branch information...
commit a2d0a846b4d568b063c104e2a04b6a5f719fe983 1 parent 7563890
Chris Williams authored
Showing with 28 additions and 6 deletions.
  1. +1 −1  dist.ini
  2. +13 −1 lib/POE/API/Peek.pm
  3. +14 −4 t/08-pid.t
2  dist.ini
View
@@ -1,5 +1,5 @@
name = POE-API-Peek
-version = 2.19
+version = 2.20
author = sungo <sungo@sungo.us>
author = Yuval Kogman <nothingmuch@woobling.org>
author = Chris 'BinGOs' Williams <bingos@cpan.org>
14 lib/POE/API/Peek.pm
View
@@ -1,6 +1,8 @@
package POE::API::Peek;
# ABSTRACT: Peek into the internals of a running POE environment
+=pod
+
=head1 DESCRIPTION
POE::API::Peek extends the POE::Kernel interface to provide clean access
@@ -842,13 +844,23 @@ Obtain a count of the process IDs being watched by a session. Takes one
optional parameter, a POE::Session object or ID. If this parameter is not
supplied, it will default to the currently active session.
+Since 1.350 of L<POE> it is no longer possible to query the number of
+processes a session is watching. This method is deprecated and will be
+removed in a future version.
+
=cut
sub session_pid_count {
my $self = shift;
my $session = shift || $self->current_session();
my $sid = ref $session ? $session->ID : $session;
- return $poe_kernel->_data_sig_pids_ses($sid);
+ my $ver = $POE::VERSION;
+ $ver =~ s/_.+$//;
+ if($ver < '1.350') {
+ return $poe_kernel->_data_sig_pids_ses($sid);
+ }
+ carp "session_pid_count() is not available for POE 1.350 and above\n";
+ return;
}
# }}}
18 t/08-pid.t
View
@@ -9,9 +9,16 @@ use Test::More tests => 10;
use_ok('POE::API::Peek');
-my $api = POE::API::Peek->new();
-POE::Session->create(
+SKIP: {
+
+ my $ver = $POE::VERSION;
+ $ver =~ s/_.+$//;
+ skip "POE version less than 1.350 required for these tests", 9 unless $ver < '1.350';
+
+ my $api = POE::API::Peek->new();
+
+ POE::Session->create(
inline_states => {
_start => \&_start,
_stop => \&_stop,
@@ -19,9 +26,12 @@ POE::Session->create(
},
heap => { api => $api },
-);
+ );
+
+ POE::Kernel->run();
+}
-POE::Kernel->run();
+exit 0;
###############################################
Please sign in to comment.
Something went wrong with that request. Please try again.