[EMAIL PROTECTED] wrote:
> Is Win32::GUI designed to support something like this:
>
> $subtxt = "Simple_Click";
>     eval qq (
>       sub main::$subtxt {
>         print "button clicked\n";
>         $W->SimpleLabel->Text("Got a click");
>     }
>     );
>
> (Actually this piece of code does not work...)

yes, Win32::GUI supports things like these (it's really Perl that
supports it :-), but your code is wrong. $W is interpreted as a
variable in your eval string, you need to escape it:

    eval qq (
        sub main::$subtxt {
            print "button clicked\n";
            \$W->SimpleLabel->Text("Got a click");
        }
    );

...and always check for $@ after an eval!


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;



Reply via email to