develooper Front page | perl.perl5.porters | Postings from October 2018

[perl #133558] perl 5.26: use lib pragma issue in IBM AIX

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
October 5, 2018 03:08
Subject:
[perl #133558] perl 5.26: use lib pragma issue in IBM AIX
Message ID:
rt-4.0.24-27073-1538708913-1850.133558-15-0@perl.org
On Thu, 04 Oct 2018 11:28:40 GMT, gskallur@gmail.com wrote:
>  perl 5.26  use lib pragma is not working in IBM AIX
> 
> use lib "<DIRPATH>";
> 
> Above code snippet fails to append the  DIRPATH to perl INC.
> Because of which perl is not able to load modules in aix

I have never used AIX, but unless something is *very* different there I do not think you are correct.

The syntax 'use lib "<DIRPATH>";' only makes sense to me if you have a directory whose name is, literally, '<DIRPATH>' beneath the current working directory.  But if you have such a directory, and if it contains a Perl module, and if your Perl program is written correctly, then the module found in that directory can be use-d and its subroutines invoked.

I suspect, however, that what the string '<DIRPATH>' means to you is a system-wide environmental variable holding a value for a special directory.  A properly written Perl program can handle that as well.  Consider:

#####
$> cd /tmp
$> mkdir '<DIRPATH>' # quotes needed because '<' is a shell metacharacter
$> mkdir system_dirpath
$> export DIRPATH=system_dirpath
$> echo $DIRPATH
system_dirpath
#####

Now, place attachment Hello.pm in directory '<DIRPATH>'.  Place attachment Goodbye.pm in directory system_dirpath.  Place program in 133558-use-lib.pl the current directory and run.

#####
$ perl 133558-use-lib.pl 
@INC:
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/5.28.0/x86_64-linux
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0
  /home/jkeenan/perl5/perlbrew/perls/perl-5.28.0/lib/site_perl/5.28.0/x86_64-linux
  /tmp/system_dirpath
  <DIRPATH>

Hello world

Goodbye world
#####

Thank you very much.
-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=133558

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About