in reply to Eval tomfoolery...

I think your first problem to solve needs to be: "how the heck did I get a function call stored in a variable instead of as module or include file, and how do I fix that?".

Down the eval path usually lie monsters.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Eval tomfoolery...
by ismail (Acolyte) on Dec 13, 2000 at 00:39 UTC
    it's like that because I'm writing an HTML templating scheme. I'd use the s00p0r regex to resolve it:

    $template =~ s {%% (.*?) %%} {exists ($fillings->{$1}) ? $fillings->{$1} : "" }gsex;

    ... but I need to be able to more gracefully handle errors than just putting a "" in. f.
      Please don't write Yet Another HTML Templating Scheme. I'd suggest Template Toolkit. Go hence, right away. Do not reinvent the wheel until you understand ALL THE OTHER WHEELS first. And asking basic questions like "how do I use eval?" already scares me about you.

      -- Randal L. Schwartz, Perl hacker

        Well, basic it may be, however I've never done it. So what? Normally I work around it because I've known that "down the eval path usually lie monsters".. I mean, duh!

        As for the templating, so what? Why does it bother you? I've used Mason and an early version of EmbPerl, and they both proved to be OK (Mason a bit more so), however both were painful to setup and messy in the logs. I don't purport to be writing Sheer Geniosity(tm) here, but I have the time for writing a templating system in an environment where it is likely that I will be the only one looking at the code. It's the third revision of a system, the second I wrote, and the first I maintained.

        I appreciate the assistance I get here, even on the 'easy ones' but I can do without the smack.

        ismail