# NOTE: This hasn't really had any testing yet... package POE::Resource::Sessions::GCIgnore; use strict; use warnings; our $VERSION = '0.01'; # monkey-patch into POE::Kernel package POE::Kernel; sub _data_ses_collect_garbage { my ( $self, $session ) = @_; # snipping out the ASSERT_DATA/TRACE_REFCOUNT stuff # that was just copied from POE::Resource::Sessions... my $count = $kr_sessions{ $session }->[ SS_REFCOUNT ]; if ( $session->can( 'gc_ignore' ) ) { $count -= $session->gc_ignore; } return if $count > 0; $self->_data_ses_stop( $session ); }