Hello all.
My apologies for being a total POE newbie. Here's my question. When I try to use the Application Servers example from the POE Cookbook, I get the following error (in the Client part of the code):
"Attempt to bless into a reference at /usr/lib/perl5/site_perl/5.8.0/POE/Filter/Reference.pm line 111"
The line(s) it's referring to are in Reference.pm:
my $self = bless { buffer => '',
expecting => undef,
thaw => $tt,
freeze => $tf,
compress => $compression,
}, $type;
That's strange! What's wrong? I just installed POE today using the instructions from poe.perl.org, which were:
% perl -MCPAN -e shell
cpan> install POE
The install seemed to work fine. My version of perl is
This is perl, v5.8.0 built for i386-linux-thread-multi
I'm running Redhat Linux. I just recently installed Linux, so I'm dealing with a lot of unknowns. :-(
Thanks for any insights in advance....
Here's the code for the client that I'm using:
#!/usr/bin/perl
use warnings;
use strict;
use POE;
use POE::Filter::Reference;
use POE::Component::Server::TCP;
use POE::Component::Client::TCP;
POE::Component::Client::TCP->new
( Alias => "sum_client",
RemoteAddress => "localhost",
RemotePort => 12345,
Filter => POE::Filter::Reference->new, # this is naughty?
# Build a request and send it.
Connected => sub {
my $heap = $_[HEAP];
my @request =
qw( 0 2.718 3 3.1416 5 6 7 8 9 four score and seven years ago );
$heap->{server}->put( \@request );
},
# Receive a response, display it, and shut down the client.
ServerInput => sub {
my ( $kernel, $hash ) = @_[ KERNEL, ARG0 ];
if ( ref($hash) eq 'HASH' ) {
print "Client received:\n";
foreach ( sort keys %$hash ) {
my $value = $hash->{$_};
$value = "@$value" if ref($value) eq 'ARRAY';
printf "\t%-4s = $value\n", $_;
}
}
else {
print "Client received an unknown response type: ", ref($hash), "\n";
}
$kernel->yield("shutdown");
},
);
### Run both the client and server. Yes, in the same program.
$poe_kernel->run()
- Re: POE::Filter::Reference error? Bret Truchan
- Re: POE::Filter::Reference error? Tatsuhiko Miyagawa
- Re: POE::Filter::Reference error? Bret Truchan
