cd /tmp mkdir fooa mkdir foob touch ./fooa/startlib.pl touch ./foob/startlib.pl touch ./foo.pl export RUNMETH='DEBUG'
In fooa/startlib.pl
#!/usr/bin/perl -w our $money = 10000; 1;
In foob/startlib.pl
#!/usr/bin/perl -w our $money = 20000; 1;
In foo.pl
#!/usr/bin/perl -w BEGIN { if ($ENV{'RUNMETH'} eq 'DEBUG'){ chdir qq~/tmp/working/fooa~; } else { chdir qq~/tmp/working/foob~; } } require qq~./startlib.pl~; print $money; 1;
Back in my day we had a development, a test, an acceptance, and various production instances. Code and configurations were all dependent on what you were working on. This was a useful way. Perhaps nowadays there is a superior method but, as you can see, this still works.
Celebrate Intellectual Diversity
In reply to Re: Use of BEGIN block
by InfiniteSilence
in thread Use of BEGIN block
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |