Page 1 of 1

Perl bug?

Posted: Thu Oct 31, 2002 7:59 pm
by MacroSloth
Hi,

I guess this message is for AMadMonk, or whomever is supporting the Perl module.

I just tried the following code (the code button is not working for me):


test.pl:
--------
sub testStructures {
my $currentTarget;

$currentTarget={
name => MQPerl::ParseVars("\$target(name)")
};

return $currentTarget;
}

MQPerl::DoCommand("/press F1");
$test=testStructures();
print "Here is the name: $test->(name)";
1;

----------


I can't see anything wrong with that code,..it should create a record with the contents of the $target(name) eval.

When I try this, it hangs EQ.

Is this a bug, or am I doing something wrong?

Thanks for any help,


MacroSloth

Posted: Sat Nov 02, 2002 8:07 pm
by AMadMonk
Slight bug in your code :)

Change this:

Code: Select all

print "Here is the name: $test->(name)"; 
to this:

Code: Select all

print "Here is the name: $test->{name}"; 
... and let me know if it still doesn't work :)

Hint: the first format tries to evaluate it as a function. When I took your snippet and put it into a standalone Perl script (outside of MQ), I instantly saw the problem when it said:
Not a CODE reference at C:\temp\110102\test1.pl line 13.