Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Execute perl in template file

by nomad.dexter (Novice)
on Jan 11, 2019 at 06:08 UTC ( #1228365=perlquestion: print w/replies, xml ) Need Help??

nomad.dexter has asked for the wisdom of the Perl Monks concerning the following question:

Hello I'm working on a theme that has template files But whenever I try to use perl block in that I get error that EVAL_PERL is not set. I want to where I can set that option So far I have found that we can add this in config but I have no idea where the template file is being processed If I can set the option in tmpl file Please let me know. Regards

Replies are listed 'Best First'.
Re: Execute perl in template file
by 1nickt (Abbot) on Jan 11, 2019 at 06:18 UTC

    Hi, it's an option you must pass to your constructor.

    my $tt2 = Template->new({ EVAL_PERL => 1 });

    Hope this helps!

    The way forward always starts with a minimal test.
      Where can i find the place to put it in a WHM theme

        I would imagine that most shared hosting providers disable it intentionally since they cannot control the Perl code users would insert. You may have to upgrade to a dedicated server and learn how to run your own web server.

        The way forward always starts with a minimal test.
        I'm not familiar with WHM, but that change needs to be made within the Perl code which runs the site, not the templates. It can't be enabled from the templates unless they're able to run Perl code, and the templates can't run Perl code unless it's already enabled.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1228365]
Approved by marto
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2019-10-17 09:08 GMT
Find Nodes?
    Voting Booth?