in reply to Re: Prepocessing perl code / substing variables
in thread Prepocessing perl code / substing variables

There are good reasons for NOT storing configuration data as Perl code:

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^2: Prepocessing perl code / substing variables

Replies are listed 'Best First'.
Re^3: Prepocessing perl code / substing variables
by karlgoethebier (Abbot) on Apr 16, 2019 at 13:15 UTC

    Sure. And the world is a bad place. Did you ever avoid to load a module because it can execute arbitrary code?

    I would prefer command-line parameters but if the OP insists loading constants from a module isn't so bad IMHO:

    package MyConf { use constant NOSE => q(cuke); use feature qw(say); say __PACKAGE__; 1; }
    #!/usr/bin/env perl use strict; use warnings; use feature qw(say); use lib q(.); use MyConf; say qq(My nose isa @{[MyConf::NOSE]}!); __END__

    Best regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help