[Solved] Path to perl libs?

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
wt0vremr
Posts: 4
Joined: 11. Mar 2012, 08:55

[Solved] Path to perl libs?

Post by wt0vremr »

I use Salix 13.37 XFCE, works perfect. :P
The only issue is - perl can't find their own libaries. I installed perl-ui-dialog using gslapt. After that I tried to run this script, example from the man page Gtk2::Dialog:

Code: Select all

 Use Gtk2::Dialog
       # create a new dialog with some buttons - one stock, one not.
         $dialog = Gtk2::Dialog->new ($title, $parent_window, $flags,
                                      'gtk-cancel' => 'cancel',
                                      'Do it'      => 'ok');
         # create window contents for yourself.
         $dialog->get_content_area ()->add ($some_widget);

         $dialog->set_default_response ('ok');

         # show and interact modally -- blocks until the user
         # activates a response.
         $response = $dialog->run;
         if ($response eq 'ok') {
             do_the_stuff ();
         }

         # activating a response does not destroy the window,
         # that's up to you.
         $dialog->destroy;
Can't locate Gtk2/Dialog.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.12.3/i486-linux-thread-multi /usr/lib/perl5/site_perl/5.12.3 /usr/lib/perl5/vendor_perl/5.12.3/i486-linux-thread-multi /usr/lib/perl5/vendor_perl/5.12.3 /usr/lib/perl5/5.12.3/i486-linux-thread-multi /usr/lib/perl5/5.12.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.10.1 /usr/lib/perl5/vendor_perl .) at dlg.pl line 5.
BEGIN failed--compilation aborted at dlg.pl line 5.


I know that Dialog.pm is located here: /usr/lib/perl5/vendor_perl/5.12.3/UI/Dialog.pm

By the way, I also have Curses::UI installed, and, unlike ui-dialog, it works just fine.
Why does not perl see it if /usr/lib/perl5/vendor_perl is included in @INC? What can I do to fix it? :roll:
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Path to perl libs?

Post by Shador »

It's looking for:
wt0vremr wrote:Gtk2/Dialog.pm
but as you said the actual location is:
wt0vremr wrote:UI/Dialog.pm
So I guess when you use UI::Dialog it's going to work.
Image
wt0vremr
Posts: 4
Joined: 11. Mar 2012, 08:55

Re: Path to perl libs?

Post by wt0vremr »

Shador wrote:It's looking for:
wt0vremr wrote:Gtk2/Dialog.pm
but as you said the actual location is:
wt0vremr wrote:UI/Dialog.pm
So I guess when you use UI::Dialog it's going to work.
Tried both, still no good. Perl-UI-dialog and perl-gtk2 don't work.
User avatar
gapan
Salix Wizard
Posts: 6244
Joined: 6. Jun 2009, 17:40

Re: Path to perl libs?

Post by gapan »

perl-gtk2 definitely works because there are packages in the repositories that use it and work perfectly fine. One example I certainly know is gcstar. Another one is zim, which is also installed by default. I don't know perl, so I don't know what could be wrong in your code, but there has to be something wrong.
Image
Image
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Path to perl libs?

Post by Shador »

Ok, I just did some testing myself right now. There are multiple issues with this code. First of all you need to use 'use' and not 'Use' with a capitalized 'U'. Next there is not Gtk2::Dialog, at least not provided by perl-ui-dialog. It provides UI::Dialog, but that's a different package. So even if I change Gtk2 to UI the code obviously won't run as it's written for another library.
Sorry, but that problem is definitely not with our packaging. The problem is your code and how you try to use those packages.

And yes, I'm no expert with perl, because I dislike its imho not straightforward syntax. But just last Friday I had to use the vmware vi perl SDK for work, so I have at least a rough idea what I'm talking about.
Image
User avatar
fredg
Posts: 232
Joined: 3. Oct 2009, 16:50
Location: Lyon, France
Contact:

Re: Path to perl libs?

Post by fredg »

perl-ui-dialog has nothing to do with perl-gtk2.

http://search.cpan.org/~kck/UI-Dialog-1 ... Dialog.pod
Quoted from CPAN:
UI::Dialog is a OOPerl wrapper for the various dialog applications. These dialog backends are currently supported: Zenity, XDialog, GDialog, KDialog, CDialog, and Whiptail. There is also an ASCII backend provided as a last resort interface for the console based dialog variants. UI::Dialog is a class that provides a strict interface to these various backend modules. By using UI:Dialog (with it's imposed limitations on the widgets) you can ensure that your Perl program will function with any available interfaces.
Your code snippet is not really usable as it.
Before doing some Perl stuff, try to read about it a bit.

Begin your script with:

Code: Select all

#!/usr/bin/env perl
use stricts;
use warnings;
To play with perl-gtk2 (once installed), you have to load the Gtk2 module

Code: Select all

use Gtk2 '-init';
No need of your Use Gtk2::Dialog

To play with all the $var found in your script, you have to declare them:

Code: Select all

my $var1;
my $var2;
...
....

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2.html
http://gtk2-perl.sourceforge.net/doc/gt ... HelloWorld

A good one:
http://media.scottr.org/presentations/gtk2-perl.pdf

++
Post Reply