Is this question so basic no one wants to answer, or is no one listening (I fear the first)
Jay "Jake" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I want to write a package which contains my client code. I don't want to > use globals, to pass data from the server response to my public interface > but I can't find an example. Roughly here is what I'd like to do, but don't > know how: > > package MyApp::POEC; > > use strict; > use warnings; > > require Exporter; > our @ISA = qw(Exporter); > our @EXPORT_OK = qw[quote]; > > use POE qw(Component::Client::TCP Filter::Reference); > > sub quote { > my %data; > > POE::Component::Client::TCP->new( > RemoteAddress => "localhost", > Filter => "POE::Filter::Reference", > RemotePort => 11111, > Connected => \&connected, > ## somehow here at ServerInput pass \%data > ServerInput => \&serverResponse > ); > > $poe_kernel->run(); > # > # Here I'd like to print the stuff passed back by the server > # like: > print join(",",map{"$_ = $data{$_}"} keys %data,"\n"; > > # I don't know maybe there is some way to pass the stuff inside of the HEAP > # but I can't see how I'd get to it at this point of the program > } > > sub connected { > > my $heap = $_[HEAP]; > my $symbol = 'QQQ'; > $heap->{server}->put(\$symbol); > } > > sub serverResponse { > > my ( $kernel, $data) = @_[ KERNEL, ARG0 ]; > # > # Here I'd like to pass "$data" back to "quote" (i.e. the caller) > # > $kernel->yield("shutdown"); > } > > > > >
