LDP/LDP/guide/docbook/abs-guide/eval.example

23 lines
646 B
Plaintext
Raw Normal View History

2003-01-06 21:26:12 +00:00
In the Perl script "test.pl":
...
my $WEBROOT = <WEBROOT_PATH>;
...
To force variable substitution try:
$export WEBROOT_PATH=/usr/local/webroot
$sed 's/<WEBROOT_PATH>/$WEBROOT_PATH/' < test.pl > out
But this just gives:
my $WEBROOT = $WEBROOT_PATH;
However:
$export WEBROOT_PATH=/usr/local/webroot
2004-01-05 13:20:57 +00:00
$eval sed 's%\<WEBROOT_PATH\>%$WEBROOT_PATH%' < test.pl > out
2003-01-06 21:26:12 +00:00
# ====
That works fine, and gives the expected substitution:
2004-01-05 13:20:57 +00:00
my $WEBROOT = /usr/local/webroot;
### Correction applied to original example by Paulo Marcel Coelho Aragao.