Data::Dumper confusion

Discussion in 'Perl Misc' started by swen, Oct 7, 2003.

  1. swen

    swen Guest

    the code:

    use Data::Dumper;
     
    swen, Oct 7, 2003
    #1
    1. Advertising

  2. swen

    Bob Walton Guest

    swen wrote:

    > the code:
    >
    > use Data::Dumper;
    > .
    > .
    > .
    > $Data::Dumper::Useqq = 1; # i have also tried with a setting of 0
    > my $search = eval(Dumper($params));
    > print "addSearch(): Dumper(\$params) = ".Dumper($params);
    > print "addSearch(): Dumper(\$search) = ".Dumper($search);
    > print "addSearch(): Dumper(eval(Dumper(\$params))) =
    > ".Dumper(eval(Dumper($params)));
    >
    > the output (you can also see what $params contains):
    >
    > addSearch(): Dumper($params) = $VAR1 = {
    > "returnFields" => [
    > "pr.status",
    > "pr.requestor"
    > ],
    > "searchFields" => [
    > {
    > "and_or" => "and",
    > "name" => "pr.status"
    > }
    > ]
    > };
    > addSearch(): Dumper($search) = $VAR1 = undef;
    > addSearch(): Dumper(eval(Dumper($params))) = $VAR1 = undef;
    >
    > Can someone tell me why the eval returns undef? I'm missing something.
    >


    That's not what I get with your code verbatim (Windoze 98SE, AS build 806):

    D:\junk>perl junk391.pl
    addSearch(): Dumper($params) = $VAR1 = {
    "searchFields" => [
    {
    "name" => "pr.status",
    "and_or" => "and"
    }
    ],
    "returnFields" => [
    "pr.status",
    "pr.requestor"
    ]
    };
    addSearch(): Dumper($search) = $VAR1 = {
    "searchFields" => [
    {
    "name" => "pr.status",
    "and_or" => "and"
    }
    ],
    "returnFields" => [
    "pr.status",
    "pr.requestor"
    ]
    };
    addSearch(): Dumper(eval(Dumper($params))) =
    $VAR1 = {
    "searchFields" => [
    {
    "name" => "pr.status",
    "and_or" => "and"
    }
    ],
    "returnFields" => [
    "pr.status",
    "pr.requestor"
    ]
    };

    D:\junk>

    Code I used:

    $params = {
    "returnFields" => [
    "pr.status",
    "pr.requestor"
    ],
    "searchFields" => [
    {
    "and_or" => "and",
    "name" => "pr.status"
    }
    ]
    };
    use Data::Dumper;
    $Data::Dumper::Useqq = 1; # i have also tried with a setting of 0
    my $search = eval(Dumper($params));
    print "addSearch(): Dumper(\$params) = ".Dumper($params);
    print "addSearch(): Dumper(\$search) = ".Dumper($search);
    print "addSearch(): Dumper(eval(Dumper(\$params))) =
    ".Dumper(eval(Dumper($params)));

    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Oct 7, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kamal
    Replies:
    0
    Views:
    991
    kamal
    Aug 12, 2003
  2. Eric
    Replies:
    0
    Views:
    4,442
  3. rc
    Replies:
    3
    Views:
    1,883
    Chris Uppal
    Aug 16, 2004
  4. Sam

    Data::Dumper for Java?

    Sam, Nov 30, 2004, in forum: Java
    Replies:
    4
    Views:
    7,721
    Anonymous
    Feb 11, 2011
  5. Replies:
    4
    Views:
    251
    Paul Lalli
    Aug 1, 2007
Loading...

Share This Page