BlueT has asked for the wisdom of the Perl Monks concerning the following question:
Bcoz of the Frontier cannot return multiple Hashes+Arrays at the same time, so I'm trying to put all arrays and hashes into one %Hash to return.
But, the Hash in Array in Hash doesn't recognized by Frontier,
should be a Hash ref insdead of a member of the parent array, but Frontier shows it as an array.$data->{content}[1];
#!/usr/bin/perl # # Project A - Parsing engine Template (PeT) # # Author: BlueT <BlueT@BlueT.org> # Since 2007/07 # one PeT for one site, # this Template is for extracting data from tables for specific site. use strict; use warnings; use Frontier::Daemon; my $listen_ip='127.0.0.1'; my $listen_port='5566'; my $d = Frontier::Daemon->new( methods => { extract => \&extract, }, LocalAddr => "$listen_ip", LocalPort => "$listen_port", ); sub extract { my %data = ( site_name => "site name", content => [ # array ref ( # this is [0], a hash ref handicap => [ 0, "asia", "BigSmall" ], A => [ "name", "asia_score", "BigSmall_score" ], B => [ "name", "asia_score", "BigSmall_score" ], ), ( # this is [1] handicap => [ 0, "asia", "BigSmall" ], A => [ "name", "asia_score", "BigSmall_score" ], B => [ "name", "asia_score", "BigSmall_score" ], ), ], ); return \%data; }
Part of my codes in client side is HERE.
The results'
HERE.
And i'd reformated the packet content, shown
HERE.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: send $Hash{$array[%Hash]} using Frontier Question.
by FunkyMonk (Bishop) on Aug 01, 2007 at 11:29 UTC | |
by BlueT (Sexton) on Aug 01, 2007 at 11:37 UTC |