----- Original Message ----- 
From: "Sisyphus" <[EMAIL PROTECTED]>

>
> ----- Original Message ----- 
> From: "Igor Litmanovich" <[EMAIL PROTECTED]>


> >
> > I'm trying to run a non-blocking command with Tk::ExecuteCommand
> > on perl5.8 but do not get any output in tk window, although the
> > command is executed.

> The problem seems to be associated with the following line of code from
the
> execute_command() subroutine:
>
> $self->{-pid} = open $h, $self->{-command} . ' 2>&1 |';
>

That's a little off the mark ... I subsequently found that _read_stdout()
never got called with perl 5.8, whereas it did get called with perl 5.6. I
was able to get _read_stdout() called by changing (in execute_command):

$self->fileevent($h, 'readable' => [\&_read_stdout, $self]);

to:

$self->fileevent($h, 'readable' => [\&_read_stdout($self)]);

But that still doesn't work properly with Loop.pl and is apparently the
wrong approach to a solution. You see the ">> 1\n", and the process then
just hangs. (The "\n" appears as a square box.) Even with a script that
doesn't loop, the fact that the script has finished doesn't register with
the Tk app, and the 'Cancel' button keeps flashing.

On the other hand, that change is unacceptable to perl 5.6 - it produces the
error "Not a CODE reference ...", and, as far as I can tell, should lead to
the exact same error with perl 5.8, but for some reason doesn't.

None of this rings any bells with me regarding changes between 5.6 and 5.8
on Win32 but apparently something has changed that is relevant to this....
the solution is probably quite simple but it still eludes me. I think my
main problem is that I don't understand what "$self->fileevent($h,
'readable' => [\&_read_stdout, $self]);" actually does (or is supposed to
do) - and I can't find any examples or documentation that helps. I also
can't find anything about how to pass argument lists where references to
subroutines are involved - yet _read_stdout() definitely expects (and gets)
at least one argument.

Cheers,
Rob




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to