Is there a way to avoid putting the Perl version number into the "use lib" line for Perl modules in non-standa
Tag : perl , By : kennystone
Date : March 29 2020, 07:55 AM
wish of those help Currently I have installed via the following prescription, which seems to fix things. perl Makefile.PL --no-manpages --skipdeps PREFIX=/non/system/location INSTALLSITELIB=/non/system/location/lib INSTALLSITEBIN=/non/system/location/bin INSTALLMAN1DIR=/non/system/location/man/man1 INSTALLMAN3DIR=/non/system/location/man/man3
|
Defining constants for a number of scripts and modules in perl
Tag : perl , By : Mostapen
Date : March 29 2020, 07:55 AM
I hope this helps you . Create a module to hold your configuration information. In file My/Config.pm in your perl library path: package My::Config;
use warnings;
use strict;
use Carp ();
my %setup = (
one => {path => '/some/path'},
two => {path => '/other/path'},
);
my $config = $setup{ $ENV{MYCONFIG} }
or Carp::croak "environment variable MYCONFIG must be set to one of: "
.(join ' ' => keys %setup)."\n";
sub AUTOLOAD {
my ($key) = our $AUTOLOAD =~ /([^:]+)$/;
exists $$config{$key} or Carp::croak "no config for '$key'";
$$config{$key}
}
use My::Config;
my $path = My::Config->path;
|
A proper way of using Perl custom modules inside of other Perl modules
Date : March 29 2020, 07:55 AM
Hope that helps I strongly disagree with modifying @INC in modules. It causes all kinds of headaches. Let the script (or even the calling process via the PERL5LIB environment variable) setup @INC correctly. script.pl: use FindBin qw( $RealBin );
use lib
"$RealBin/../ModulesFolder1",
"$RealBin/../ModulesFolder2";
use ModuleInFolder1;
use ModuleInFolder2; # Works fine.
|
Perl to generate one executable file for a script which uses any number of modules and libraries
Tag : perl , By : Arun Thomas
Date : March 29 2020, 07:55 AM
will be helpful for those in need pp script provided with PAR::Packer is able to create single-file executables. An example from its page: pp -o foo foo.pl bar.pl # Pack 'foo.pl' and 'bar.pl' into 'foo'
|
Can I re-use modules compiled with a different build of Perl, but with the same version number?
Date : March 29 2020, 07:55 AM
I wish this help you It turns out that, YES, you can re-use modules compiled with different builds of Perl that have the same version number. The trick, as stated above, is to build your localperl with the ./Configure flags as close as possible to your system Perl. You can determine the ./Configure flags your system Perl uses by running perl -V. You should then use those settings with the flags listed above. My intuition is that -Dcc= and -Darchname= are the critical ones to match, though I have not had time to test this assumption. So, what was my problem if I had already done all of this, and it still wasn't working? Simple - the test script! In my shebang line, I was still pointing to a faulty build of Perl that I had compiled earlier that day! D'oh! Once I pointed the script to the new build with all of the extra ./Configure options, it worked perfectly fine and was able to use all of the modules built with system Perl.
|