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

Template Toolkit install path

by EvanCarroll (Chaplain)
on Sep 09, 2007 at 22:13 UTC ( #637940=perlquestion: print w/replies, xml ) Need Help??
EvanCarroll has asked for the wisdom of the Perl Monks concerning the following question:

What is the best way to install TT templates that a CPAN module will use? Need information with M::I, and as far as location goes. Template wants to load them with a hard path, which is outside of the scope of perl module resolution.

To prevent an XY problem: I've got a script on cpan psql-plus which has an option `--output xhtml|yaml|json` for xml and xhtml, they are simply Templates, so how and where should I put them, and how do I call them. I was thinking inside of a module's __DATA__ section and returning a FH to __DATA__ but that seems hackish. Any better ideas?



Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re: Template Toolkit install path
by LTjake (Prior) on Sep 10, 2007 at 00:29 UTC

    Would Module::Install::Share and File::ShareDir help?

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

      I think you hit the nail on the head. This sounds to be *exactly* what I'm looking for. I found this on problems File::ShareDir solves. Another method is to put the data "file" after the __DATA__ compiler tag and limit yourself to access as a filehandle. Right inside of File::ShareDir. Thanks a ton.


      Evan Carroll
      www.EvanCarroll.com

        Might I also suggest my own Template::Provider::FromDATA which will give you exactly that functionality.

        --
        "Go up to the next female stranger you see and tell her that her "body is a wonderland."
        My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
        " (src)

Re: Template Toolkit install path
by Fletch (Chancellor) on Sep 10, 2007 at 13:28 UTC

    Inline::Files gives a method for slightly more transparent access to several files in the DATA section (granted you easily can do the same yourself with a _fetch_from_DATA sub that hides the read-up-until-end-marker behavior, but the module makes it slicker).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://637940]
Approved by GrandFather
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-07-20 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (431 votes). Check out past polls.

    Notices?