Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Execute perl in template file

by nomad.dexter (Initiate)
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2019-01-19 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    After Perl5, I'm mostly interested in:
































    Results (338 votes). Check out past polls.

    Notices?