[Kde-perl] Problem returning QByteArray from QProcess::readStdout

Terrence Fleury (Terry) tfleury at ncsa.uiuc.edu
Tue Jun 24 18:59:09 CEST 2003


Hello,

I'm trying to get a program working where I launch a sub-process (which is
another command) and continue processing.  Reading some of the past posts, I
saw that I cannot use "fork" due to GUI problems, and threads aren't working
either.  So, it was suggested to use QProcess.

I am able to set up a process that launches the external command.  I connect
a SLOT called readFromStdout to the readyReadStdout SIGNAL:

    my $readProc;   # Variable has package scope

    sub initialize
    {
      $readProc = Qt::Process(this);
      my @args = ('mycommand','arg1','arg2');
      $readProc->setArguments(\@args);
      Qt::Object::connect($readProc, SIGNAL 'readyReadStdout()', 
                          this,      SLOT   'readFromStdout()');
      if (!$readProc->start())
        { # Error handling here
        }
    }

    sub readFromStdout
    {
      my $readIn = $readProc->readStdout();
    }

When readFromStdout gets called, I use the readStdout method to try to read
in the output generated.  However, I get the following error:

    Cannot handle 'QByteArray' as return-type of QProcess::readStdout at /usr/lib/perl5/site_perl/5.6.1/i386-linux/Qt.pm line 224.

So, if PerlQt can't handle QByteArrays, then QProcesses are basically
useless.  What else can I do?

I'm using Perl 5.6.1 and PerlQt 3.006.  Do I need to upgrade one or both of
these to get things working?

Thanks for any help you can offer.

Terrence Fleury
tfleury at ncsa.uiuc.edu



More information about the Kde-perl mailing list