[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] How to add extra "use" clauses
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2003-04-04 23:57:01
[Download RAW message or body]

Le Vendredi 04 Avril 2003 02:49, Terrence (Terry) Fleury a écrit :
> Hello,
>
> I'm very new to PerlQt.  Just starting using it yesterday!  However, I
> already found something that I needed it to do that I couldn't figure out,
> so I created a patch for "puic" to do it.
>

Hello Terrence,
Thanks for the nice patch... adding "use" clauses proves indeed difficult with 
current puic and your solution looks fair.
It might be a tad confusing/unintuitive to have use statements in an "include" 
section, but still it looks like the best Perl analogy we can have.

Anyway, I'll test it a bit usability-wide and eventually commit it.

Cheers,
Germain

(that's really too bad this whole Qt Designer support still looks like a big 
fat hack... I wonder how hard it would be to implement full PerlQt support 
directly inside the designer. 
I didn't look close at the code yet but it looks like it's quite ready for 
other languages support... 
The most tricky part would obviously be to have the changes included back by 
Trolltech.)


> I checked the archives and somebody had asked the question about how to add
> arbitrary "use" clauses at the top of the file.  (He also asked about
> adding global variables but that hasn't come up for me yet.)  I need to be
> able to include other libraries on my system by doing something like this:
>
>     use lib "$ENV{HOME}/lib";
>     use MYUTILS::Extras;
>
> where the extra library file is $HOME/lib/MYUTILS/Extras.pm
>
> I patched puic to look for items in the "Includes (in Declaration)" area of
> the "Object Explorer/Source" tab.  This puts the new "use" clauses after
> the Qt::attributes stuff.  Not the best place, I know, but it was easy to
> code this way.
>
> So for the above example, I go to the "Object Exporer" window, click the
> "Source" tab, and double-click on "Includes (in Declaration)" to add a new
> item.  The items I add are:
>
>     MYUTILS::Extras
>     lib "$ENV{HOME}/lib
>
> Notice that there's no "use" statement nor ending semicolon.  These are
> added automatically.  I suppose it would be more general to force the user
> to prepend the "use " string (since that way this could also be used for
> global variables).  I'm not sure which makes more sense.
>
> Use it (or not) at your own risk.  Copy the attached patch to a file in the
> PerlQt-3.006/puic source directory.  Name it "form.cpp.patch".  Make a
> backup of the form.cpp file by doing "cp form.cpp form.cpp.orig".  Then do
> "patch -p0 < form.cpp.patch".  Rebuild by doing "make" in that directory.
> Good luck!
>
> Oh, and thanks very much to the developers for a really cool product!
>
> Terry Fleury
> tfleury@ncsa.uiuc.edu

_______________________________________________
Kde-perl mailing list
Kde-perl@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-perl

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic