in reply to Re^2: how to get Perl hash in C#
in thread how to get Perl hash in C#

What is this "everything" that appears in the Data::Dumper output? Is it stuff that would be nonsensical in JSON output? (e.g. coderefs, pointers to open file handles, etc)

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

Replies are listed 'Best First'.
Re^4: how to get Perl hash in C#
by Hossein (Acolyte) on Jan 27, 2014 at 08:02 UTC
    Hi,

    Tha hash values are arrays. These arrays can contain some hash too. Below is the output from Data::Dumper.

    I need these values imported av hash/"collection" in C#

    $VAR1 = bless( { 'INTERFACE' => [ undef, 'vlanX' ], 'LOCATION' => 'X3', 'ACELOGICAL' => 'user', 'CHILD' => [ bless( { 'IPROUTE' => '0.0.0.0 0.0.0.0 x +xx.xxx.x.x.', 'NAME' => 'vlanX', 'ACE' => 'ACEx', 'CHILD' => [ bless( { 'IPROUTE' + => undef, 'NAME' => 'name', 'INTERFACE' => 'vlanX', 'ACE' => undef, 'SERVERFARM' => undef, 'CHILD' => [], 'OSID' => [], 'ALIAS' => undef, 'OBJECTID' => undef, 'PARENT' => [ $VAR1->{'CHILD'}[0] ], 'MASTERSHAPE' => 'ACE_RSERVER', 'CONTEXT' => 'Cntext', 'SHAPEID' => [], 'IPADDRESS' => 'xxx.xxx.x.xx' }, 'some value' ), 'IPROUTE' + => undef, 'NAME' => 'name', 'INTERFACE' => 'vlanX', 'ACE' => undef, 'SERVERFARM' => undef, 'CHILD' => [], 'OSID' => [], 'ALIAS' => undef, 'OBJECTID' => undef, 'PARENT' => [ $VAR1->{'CHILD'}[0] ], 'MASTERSHAPE' => 'ACE', 'CONTEXT' => 'some value ', 'SHAPEID' => [], 'IPADDRESS' => 'xxx.xxx.x.xx' }, 'some value' ), . . .

      JSON cannot transport "objects". What would C# do with Perl classes?

      You will need to convert your objects to plain hashes (or arrays) that contain the relevant data.

        Thank you for your answer.

        I was not aware of that :(