Dr.Ruud schreef:
> Tom Phoenix:

>> the text eval is a dangerous and powerful beast, not
>> easily tamed. Avoid avoid avoid.
>
> Ack.
>
> Do you know of a serious and safe way to use macros that are expanded
> inline?
>
> For example:
>
>   lookup_table 'table', 'run_', (cat, jackalope, yeti);
>
> would expand to:
>
>     my %table = (  cat        =>  \&run_cat
>                 ,  jackalope  =>  \&run_jackalope
>                 ,  yeti       =>  \&run_yeti
>                 );

Or rather to:

     my %table =
        (
          cat       => \&run_cat,
          jackalope => \&run_jackalope,
          yeti      => \&run_yeti,
        );

because that is easier to generate.

The module Filter::Simple (and maybe the module Macro, which is on top
of that) seems feasible for this.

I am used to generating code in a separate step, like with cpp or
yacc/lex.

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to