http://qs321.pair.com?node_id=382845


in reply to using POE::Component::IRC

The problem is that you're assigning a new hash reference to $heap in _start. Let's see if I can explain this correctly...

The _start sub gets called with a reference to the heap, stored internally by POE. You then store this reference in $heap and can then view or modify the real heap, but only through it's reference. In your code, you create an anonymous hash reference and assign it to $heap. This overwrites the reference that was in $heap pointing to the real "heap" location with a temporary one that goes out of scope when your sub exits. End result, it works fine within the _start sub, but after that all the changes mysteriously disappear.

What you need to do is keep the reference in tact when you assign new values to it, with something like this:

%$heap = ( PARAMS => { NICK => "", CONNECTED => 0, } );

Hope that helps!

Replies are listed 'Best First'.
Re^2: using POE::Component::IRC
by b888 (Beadle) on Aug 16, 2004 at 10:15 UTC
    That definitly helps. Thanks.