Last active
December 26, 2015 04:19
-
-
Save tempire/7092381 to your computer and use it in GitHub Desktop.
Load templates from __DATA__ @@Sections with replacement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Modern::Perl; | |
| use Mojo::Template; | |
| use Mojo::Loader; | |
| say Mojo::Template->new->render(Mojo::Loader->new->data(__PACKAGE__, 'hello'), | |
| qw/ glen hinkle /); | |
| __DATA__ | |
| @@ hello | |
| % my ($fname, $lname) = @_; | |
| HELLO <%= $fname %> <%= $lname %> |
Author
If you were loading from another file, and not concerned about getting only the one @@ section of __DATA__, yes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could one not use https://metacpan.org/pod/Mojo::Util#slurp here also?