in reply to Strawberry, CPAN and PERL5

I MAY have just found a way around the problem, and that is to use $^0; this tells you the operating system. So ...

$OS=$^0;

use lib "path_to_perl5" if $OS == 'MSWin32'

IN THEORY, on Windows, it will use the revised perl5 / CPAN location, but when run on Unix server,it will bypass this line as the IF will be incorrect. (Not yet tried)

Replies are listed 'Best First'.
Re^2: Strawberry, CPAN and PERL5
by Tux (Canon) on Aug 31, 2019 at 09:01 UTC

    That condition will always be true (with a warning). To compare strings, you'll need eq, not ==.


    Enjoy, Have FUN! H.Merijn
Re^2: Strawberry, CPAN and PERL5 (updated)
by AnomalousMonk (Archbishop) on Aug 31, 2019 at 15:37 UTC
    ... a way around the problem ...
    ...
    use lib "path_to_perl5" if $OS == 'MSWin32'

    Others have correctly commented that the problem described in the OP is much more basic than conditional compilation (update: and seems to be essentially a system configuration problem). In addition to | Be that as it may, beyond the comparison operator problem pointed out by Tux, a use statement is executed at compile-time, but a
        if (condition) { ... }
    or
        ... ifcondition;
    statement executes at run-time. So the effect of

    c:\@Work\Perl\monks>perl -wMstrict -le "if ('night' eq 'day') { use constant FOO => 42; } ;; print FOO; " 42
    is not what you expect.

    Consider the if pragma for use in cases like this — but not in this particular case!

    c:\@Work\Perl\monks>perl -wMstrict -le "use if 'night' eq 'day', constant => FOO => 42; ;; print FOO; " Name "main::FOO" used only once: possible typo at -e line 1. print() on unopened filehandle FOO at -e line 1.

    Update: Made some changes in the first paragraph to try to clarify the intent and focus of this reply.


    Give a man a fish:  <%-{-{-{-<

Re^2: Strawberry, CPAN and PERL5
by Anonymous Monk on Aug 31, 2019 at 11:03 UTC
    No. Fix you're config issue. As first step post the output of
    perl -V

      Are you sure you have uninstalled Perl5 prior to installing Strawberry ?