Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How and where to pass PERL_USE_UNSAFE_INC=1; to Perl while compilation.

by ikegami (Patriarch)
on Sep 26, 2021 at 16:34 UTC ( [id://11137020]=note: print w/replies, xml ) Need Help??


in reply to How and where to pass PERL_USE_UNSAFE_INC=1; to Perl while compilation.

Your scripts are buggy, and I'm not talking about the potential security problem. They use the current work directory as a proxy for the script's directory, but that often fails.

Just write a Perl one-liner to add the following to your buggy scripts to fix them:

use FindBin qw( $RealBin ); use lib $RealBin;

Replies are listed 'Best First'.
Re^2: How and where to pass PERL_USE_UNSAFE_INC=1; to Perl while compilation.
by Anonymous Monk on Sep 27, 2021 at 06:07 UTC
    Thank you for the reply.

    That is how it was working in the application since years with perl version 5.24.

    I understand using FindBin is definitely better option than having current directory (.) but it seems to work for us.

    also finding all these files and updating is quite a task for us.

    Regards

      That is how it was working in the application since years with perl version 5.24.

      Doesn't mean it wasn't buggy; it just means you always set the CWD to be the script's directory before starting it up. You literally had to take an extra step to work around the bug.

      also finding all these files and updating is quite a task for us.

      find -name '*.pl' -exec perl -i~ -pe'$_ = "use FindBin qw( \$RealBin ) +; use lib \$RealBin;\n$_" if $. ==2' {} \;

        Thank you for the reply and the command, yes I agree with you about adding the current directory in the scripts.
        setting PERL_USE_UNSAFE_INC=1; seems to work, let me still think about the command you have provided.
        Regards.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-28 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found