Perl bug?

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

MacroSloth
decaying skeleton
decaying skeleton
Posts: 3
Joined: Thu Oct 31, 2002 4:18 pm

Perl bug?

Post by MacroSloth » Thu Oct 31, 2002 7:59 pm

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

AMadMonk
a lesser mummy
a lesser mummy
Posts: 77
Joined: Tue Sep 24, 2002 9:16 pm

Post by AMadMonk » Sat Nov 02, 2002 8:07 pm

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.