cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
At the end of this sub, $obj is an undefined scalar rather than a hash like it should be. The socket app is working and is returning a valid dumper string. I know this because I cut and pasted the value of $blob from the debugger into a separate script and I was able to eval it and get the correct object back.sub processtext { my ($hostid,$port,$text) = @_; my $socket = IO::Socket::INET->new(PeerAddr => $hostid, PeerPort => $port, Proto => "tcp", Type => SOCK_STREAM) or die "Couldn't connect: $!\n"; print $socket "$text\n"; # read the remote answer, my ($blob,$answer,$obj); while ($answer = <$socket>) { $blob .= $answer; } close($socket); $obj = eval($blob); return $obj; }
What could be keeping the $blob string from evaluating properly in this sub? I'm kinda baffled here.
TIA....Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dumper output not evaling properly
by davido (Cardinal) on Mar 16, 2006 at 01:02 UTC | |
by cormanaz (Deacon) on Mar 16, 2006 at 02:43 UTC |