Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Telling POE to ignore a filehandle for garbage collection purposes?

by jasonk (Parson)
on Mar 18, 2008 at 16:53 UTC ( [id://674834]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Telling POE to ignore a filehandle for garbage collection purposes?
in thread Telling POE to ignore a filehandle for garbage collection purposes?

After some more digging, I've pretty much come to the conclusion that what I'm trying to do can't be done without mucking around with POE internals....

Here is the code I finally came up with, though I would prefer there were a way to do it without the monkey-patch. On the other hand though, monkey-patching seems to be part of the core for POE. :)

# 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 ); }

We're not surrounded, we're in a target-rich environment!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://674834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-19 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found