# New Ticket Created by Carl Franks
# Please include the string: [perl #127375]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=127375 >
`use lib` correctly invalidates the .precomp directory, however both the
-I switch and PERL6LIB do not invalidate .precomp - meaning they are
effectively ignored when trying to override a module in a new location.
Example code:
$ cat lib/Foo.pm6
use v6;
class Foo { method bar { return 'a' } }
$ cat lib2/Foo.pm6
use v6;
class Foo { method bar { return 'b' } }
$ cat test1.pl6
use v6;
use lib 'lib';
use Foo;
use Test;
plan(1);
is( Foo.bar, 'a' );
$ cat test2.pl6
use v6;
use lib 'lib';
use lib 'lib2'; # 2nd use 'lib'
use Foo;
use Test;
plan(1);
is( Foo.bar, 'b' ); # expects return value from lib2/Foo.pm
$ cat test3.pl6
use v6;
use lib 'lib';
use Foo;
use Test;
plan(1);
is( Foo.bar, 'b' ); # expects return value from lib2/Foo.pm
$ perl6 test1.pl6
1..1
ok 1 -
$ perl6 test2.pl6
1..1
ok 1 -
$ perl6 -I lib2 test3.pl6
1..1
not ok 1 -
# Failed test at test3.pl6 line 6
# expected: 'b'
# got: 'a'
# Looks like you failed 1 test of 1
$ PERL6LIB=lib2 perl6 test3.pl6
1..1
not ok 1 -
# Failed test at test3.pl6 line 6
# expected: 'b'
# got: 'a'
# Looks like you failed 1 test of 1
$ perl6 -v
This is Rakudo version 2015.12-219-gd67cb03 built on MoarVM version
2015.12-29-g8079ca5
implementing Perl 6.c.