#25 QSocket::readblock

Stephen Leaf

unless I did this wrong, you have a bug?
I'm hoping I did something wrong .. should be easier to fix ;)

my line:
$s->readblock(my $data,$s->size());

--- No method to call for :
QSocket::readblock(undef, 70)
at /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi/Qt.pm
line 229.

Q_LONG QSocket::readBlock ( char * data, Q_ULONG maxlen )

Reads maxlen bytes from the socket into data and returns the
number of bytes read. Returns -1 if an error occurred.


  • germain garand
    germain garand

    Logged In: YES

    Hi Stephen,
    Yes it does exist, look carefully the above Qt doc snippet.
    It's readBlock, with an uppercase B, not readblock.

    The convention for Qt methods is to uppercase the first
    letter of every word in method names, except the first


    The only "exceptions" is when two words are rather a
    compound e.g it's QScrollView::viewport() not ::viewPort()

    Now,you really should use the pqtapi program that come
    with PerlQt...
    $ pqtapi -i -r readblock
    Q_LONG QBuffer::readBlock(char*, Q_ULONG)
    Q_LONG QFile::readBlock(char*, Q_ULONG)
    Q_LONG QFtp::readBlock(char*, Q_ULONG)
    Q_LONG QHttp::readBlock(char*, Q_ULONG)
    Q_LONG QSocket::readBlock(char*, Q_ULONG)
    Q_LONG QSocketDevice::readBlock(char*,

    isn't that much more informative? 8)

    Now, I owe you an apologize... It's been a long time since
    you sent your program to me and I've been too busy to
    parse it seriously.
    I couldn't really run it because there was a lacking
    external resource, but IIRC, your main problem is you are
    using threads...
    You should never ever assume a Perl module supports
    them if it isn't very clearly specified, especially when it's
    about a full blown GUI library.
    PerlQt isn't thread safe, mainly for performance reasons,
    and even if it were, that doesn't mean you can invoke
    Widget methods directly from an external thread as you
    Using a threaded Qt merely means that a _few_ methods
    are thread safe, and only those that are indicated in the
    documentation (see the "assistant" program bundled with
    Qt... look for the chapter Overviews->Thread Support in

    QSocket would indeed be a good replacement for an
    asynchronous read of datas...
    Maybe you should have a look at Rob Kudla's qtlilly
    (http://www.kudla.org)... it's a chat program for the lilly
    protocol... it's likely to have a QSocket...

    Best luck!

    P.S: before submitting a bug report you could try asking
    on the kde-perl mailinglist... that's where most of the
    development discussions happen, so you'd get answers
    much faster. See

  • germain garand
    germain garand

    • assigned_to: nobody --> germaingarand
    • status: open --> closed-invalid
  • Stephen Leaf
    Stephen Leaf

    Logged In: YES

    wow do I feel dumb now XD
    thank you for dealing with my stupidity.

    I know I shouldn't assume that things work with a threaded perl. but
    threads are something I wanted to learn and got use to using them
    over the past month. currently I'm working on a version of that
    program that uses nothing but signals for almost everything. I had to
    stop working on it tho so I could figure out what was wrong with

    pqtapi is most likely going to have alot of use now ;)

    Thanks again.