POE::Kernel->call turns an undef return result into a zero length string ''
rather than passing the undef return result.

If this is the behavior expected of 'call' please update the docs for 'call' 
as it took me a while to find this out myself the hard way.

Jason Stillwell (DragonFax on #poe)


#!/usr/local/bin/perl -w
use strict;
use POE;

# POE turns and undef result from a call() into a zero length string.

sub return_undef { return undef; }

sub test_call {
    my ($kernel,$session) = @_[KERNEL,SESSION];

    my $result = $kernel->call($session, 'return_undef');
    if ( defined($result) ) {
        print "result defined: [$result]\n";
    }
    else {
        print "result undefined\n";
    }
}

POE::Session->create( inline_states => { return_undef => \&return_undef, _start => 
\&test_call } );

$poe_kernel->run();

Reply via email to