Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Perl-Qt 2 tutorials with errors?

by ichimunki (Priest)
on Jun 28, 2001 at 18:51 UTC ( [id://92298]=perlquestion: print w/replies, xml ) Need Help??

ichimunki has asked for the wisdom of the Perl Monks concerning the following question:

I have followed the technique from this discussion and gotten Perl-Qt to compile and install with Qt-2.3.0, however when I go to run the tutorials I get the following error:
Can't locate object method "new" via package "Qt::Application" (perhaps you forgot to load "Qt::Application"?) at t1 line 3.
I've tried various requires, uses, and imports but this error won't go away.

The whole module is compiled C++ code or I would be inclined to try and peek at the source before asking but I don't read C++ yet. Can anyone offer insight as to what is going on here?

Replies are listed 'Best First'.
Re: Perl-Qt 2 tutorials with errors?
by Abigail (Deacon) on Jun 28, 2001 at 19:23 UTC
    This error message is typical when you forget the appropriate use statement. I'd expect a she-bang line on line 1, use strict on line 2, and use Qt (or some other Qt) on line 3, and then you wouldn't have a new on line 3. ;-)

    But without seeing the code, this is just guessing.

    -- Abigail

Re: Perl-Qt 2 tutorials with errors?
by httptech (Chaplain) on Nov 25, 2001 at 01:51 UTC
    I had the same problems running the tutorials after fighting to get the code to compile. Here's what I found: QtPerl works fine on my Mandrake 7.2 box using Perl 5.6.0, Qt 2.2.1 and gcc 2.95.3. However, on Mandrake 8.1 with Perl 5.6.1, Qt 2.3.1 and gcc 2.96 it gives the Can't locate object method "new" via package "Qt::Application" error on running any PerlQt app.

    I copied the Mandrake 7.2-statically-compiled module over to the Mandrake 8.1 box, but running PerlQt apps still resulted in the same error.

Re: Perl-Qt 2 tutorials with errors?
by fs (Monk) on Jun 28, 2001 at 19:16 UTC
    What's your code look like?
      The first tutorial (this is included in the module tarball) is a simple hello world (and this I can't get to run):
      #!/usr/bin/perl -w use Qt 2.0; import Qt::app; $hello = Qt::PushButton->new('Hello World!', undef); $hello->resize(100, 30); $app->setMainWidget($hello); $hello->show(); exit $app->exec();
      I suspect this is more of a technical difficulties issue, FYI: the machine is a 586 running Debian main, Perl upgraded to 5.6.1 and the Perl-Qt is the latest tarball from CPAN.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://92298]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-24 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found