Re: FVWM: Modules, Perl, and Perl Modules

From: Mikhael Goikhman <migo_at_homemail.com>
Date: Mon, 9 May 2005 09:54:53 +0000

On 09 May 2005 10:52:08 +0100, Nick Fortune wrote:
>
> I'm tending towards saying "create a directory $FVWM_USERDIR/perl and
> put the .pm files in there" and then pointing the script at the modules
> with a "use lib" directive. The trouble is that's fragile. If I
> hardcode the location and they can't use it, or don't want to use it,
> then the module breaks.

This is the way to go. Personally I would use $FVWM_USERDIR/perllib name
to match FVWM_DATADIR/perllib, since it is for classes, not for scripts.

If you want to handle the situation, you may do it in your module.

BEGIN {
        my $user_perllib_dir = "$ENV{FVWM_USERDIR}/perllib";
        die "Please create $user_perllib_dir with .pm files from http://url\n"
                unless -d $user_perllib_dir;

        use lib $user_perllib_dir;
        use MyModule1;
        use MyModule2;
}

This will show all possible errors on STDERR. If you also want to
show them in some X message box, you may use this solution instead:

BEGIN {
        my $user_perllib_dir = "$ENV{FVWM_USERDIR}/perllib";
        use FVWM::Module::Toolkit;

        FVWM::Module::Toolkit->showError("Please create ...", "My Error")
                unless -d $user_perllib_dir;

        use lib $user_perllib_dir;
        use FVWM::Module::Toolkit qw(MyModule1 MyModule2);
}

If there will be ever a practical problem (and not just theoretical,
there are no many perl module writters) I will add the built-in support,
and it will be just "use FVWM::Module::Toolkit qw(~ MyModule1 MyModule2)".

P.S. About the terminology, please use "perl classes", not "perl modules"
to avoid the confusion with "fvwm modules".

Regards,
Mikhael.
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Mon May 09 2005 - 04:55:45 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:57 BST