[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Variables in #!-lines



Am I missing something or is it simply not possible to use a
pre-defined variable in a "shebang" line? What I wanted to
do is something like

    #!wml -o %BASE.%VAR.html

and then call wml via

    wml -DVAR="whatever" filename.wml

This would greatly simplify some things for me, and I think it must be
quite simple to implement that in a manner analogous to %BASE and
%DIR; after all, @opt_D seems to hold the variable definitions, and
instead of doing just

: #   6. expand %DIR and %BASE in the -o flags
...
:     $opts =~ s|%DIR|$dir|sg;
:     $opts =~ s|%BASE|$base|sg;
:     push(@opt_o,$opts);

one might simply write something like:

: #   6. expand %DIR and %BASE in the -o flags
{ my $a, $b, $c;
...
:     $opts =~ s|%DIR|$dir|sg;
:     $opts =~ s|%BASE|$base|sg;
foreach $a (@opt_D) {
    $a =~ /^(.*)=(.*)$/;
    $b = upcase($1); $c = $2; $opts =~ s|%$a|$b|sg; }
:     push(@opt_o,$opts);

(which is not very well written nor tested, but you get the idea; I
don't know my way round the wml-source very well anyway.)

What do you think of that?


Albert.

-- 

--------------------------------------------------------------------------
Albert Reiner                                   <areiner@tph.tuwien.ac.at>
Deutsch       *       English       *       Esperanto       *       Latine
--------------------------------------------------------------------------
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com