On 28 Jul 2004 at 14:58, Sisyphus wrote:
> Glenn Linderman wrote:
>
> >
> > But, fixing it myself let me verify that that is the problem, and find
> > the next one. My app.pl uses Win32. And it then says:
> >
> > $flags = 4 | & Win32::MB_ICONQUESTION;
> >
> > which works fine as app.pl. But app.exe reports
> >
> > Undefined subroutine &Win32::MB_ICONQUESTION called at ...
> >
> > I've no clue how to workaround this one, much less fix it, so additional
> > pointers on this topic would be extremely welcome.
> >
>
> Do you need the "&" ?
> For me the following 3 statements assign the same value (ie 36) to $flags:
>
> use Win32;
> $flags = 4 | & Win32::MB_ICONQUESTION;
> $flags = 4 | Win32::MB_ICONQUESTION;
> $flags = 4 | MB_ICONQUESTION;
>
> Perhaps one/both of those last 2 ways will work around the problem ?
>
> Cheers,
> Rob
>
Win32::MB_ICONQUESTION is coded as a sub, so the syntax with the & works at the
first
level. It appears that the extra level of eval in PAR makes it look like the
equivalent
of:
$flags = 4 | & 32;
which is not legal, and gives the error:
Undefined subroutine &main::32 called at ...
I don't know how this happens and still gives the name MB_ICONQUESTION in the
error
message.
Anyway, you can't rely on the constant being implemented as a sub, and as Rob
said, it
is not neccessary.
Alan Stewart
|