1=for comment Documentation generated by YARD v0.6.4 and yard-pod-plugin v0.1.
2
3=head1 NAME
4
5Template::Mustache - Template::Mustache is an implementation of the fabulous Mustache templating
6language for Perl 5.8 and later
7
8=head1 METHODS
9
10=head2 Class Methods
11
12=over
13
14=item B<<<< new >>>>
15
16    new($class, %args) # => Template::Mustache
17
18
19Standard hash constructor.
20
21
22
23Parameters:
24
25=over
26
27=item *
28
29B<<<<< C<<<< %args >>>> >>>>> -- Initialization data.
30
31
32=back
33
34
35Returns:
36
37=over
38
39=item *
40
41(I<<<< Template::Mustache >>>>) -- A new instance.
42
43
44=back
45
46=item B<<<< partial >>>>
47
48    partial($receiver, $name) # => String
49
50
51Reads a named partial off disk.
52
53
54
55Parameters:
56
57=over
58
59=item *
60
61(I<<<< String >>>>) B<<<<< C<<<< $name >>>> >>>>> -- The name of the
62partial to lookup.
63
64
65=back
66
67
68Returns:
69
70=over
71
72=item *
73
74(I<<<< String >>>>) -- The contents of the partial (in L<<<< S<<<<<
75template_path >>>>>|template_path >>>>, of type L<<<< S<<<<<
76template_extension >>>>>|template_extension >>>>), or the empty
77string, if the partial does not exist.
78
79
80=back
81
82=item B<<<< render >>>>
83
84    render # => String
85    render($tmpl) # => String
86    render($data) # => String
87    render($tmpl, $data) # => String
88    render($tmpl, $data, $partials) # => String
89    render($tmpl, $data, $partials) # => String
90    render($tmpl, $data, $partials) # => String
91
92
93
94
95
96Overloads:
97
98
99    render # => String
100
101=over
102
103
104Renders a class or instance's template with data from the receiver.  The
105template will be retrieved by calling the L<<<< S<<<<< template
106>>>>>|template >>>> method.  Partials will be fetched by L<<<< S<<<<<
107partial >>>>>|partial >>>>.
108
109
110
111
112Returns:
113
114=over
115
116=item *
117
118(I<<<< String >>>>) -- The fully rendered template.
119
120
121=back
122
123
124
125
126=back
127
128    render($tmpl) # => String
129
130=over
131
132
133Renders the given template with data from the receiver.  Partials will
134be fetched by L<<<< S<<<<< partial >>>>>|partial >>>>.
135
136
137
138Parameters:
139
140=over
141
142=item *
143
144(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
145render.
146
147
148=back
149
150
151Returns:
152
153=over
154
155=item *
156
157(I<<<< String >>>>) -- The fully rendered template.
158
159
160=back
161
162
163
164
165=back
166
167    render($data) # => String
168
169=over
170
171
172Renders a class or instance's template with data from the receiver.  The
173template will be retrieved by calling the L<<<< S<<<<< template
174>>>>>|template >>>> method.  Partials will be fetched by L<<<< S<<<<<
175partial >>>>>|partial >>>>.
176
177
178
179Parameters:
180
181=over
182
183=item *
184
185(I<<<< Hash, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> -- Data to
186be interpolated into the template.
187
188
189=back
190
191
192Returns:
193
194=over
195
196=item *
197
198(I<<<< String >>>>) -- The fully rendered template.
199
200
201=back
202
203
204
205
206=back
207
208    render($tmpl, $data) # => String
209
210=over
211
212
213Renders the given template with the given data.  Partials will be
214fetched by L<<<< S<<<<< partial >>>>>|partial >>>>.
215
216
217
218Parameters:
219
220=over
221
222=item *
223
224(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
225render.
226
227
228=item *
229
230(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
231Data to be interpolated into the template.
232
233
234=back
235
236
237Returns:
238
239=over
240
241=item *
242
243(I<<<< String >>>>) -- The fully rendered template.
244
245
246=back
247
248
249
250
251=back
252
253    render($tmpl, $data, $partials) # => String
254
255=over
256
257
258Renders the given template with the given data.  Partials will be looked
259up by calling the given code reference with the partial's name.
260
261
262
263Parameters:
264
265=over
266
267=item *
268
269(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
270render.
271
272
273=item *
274
275(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
276Data to be interpolated into the template.
277
278
279=item *
280
281(I<<<< Code >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A function
282used to lookup partials.
283
284
285=back
286
287
288Returns:
289
290=over
291
292=item *
293
294(I<<<< String >>>>) -- The fully rendered template.
295
296
297=back
298
299
300
301
302=back
303
304    render($tmpl, $data, $partials) # => String
305
306=over
307
308
309Renders the given template with the given data.  Partials will be looked
310up by calling the partial's name as a method on the given class or
311object.
312
313
314
315Parameters:
316
317=over
318
319=item *
320
321(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
322render.
323
324
325=item *
326
327(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
328Data to be interpolated into the template.
329
330
331=item *
332
333(I<<<< Class, Object >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A
334thing that responds to partial names.
335
336
337=back
338
339
340Returns:
341
342=over
343
344=item *
345
346(I<<<< String >>>>) -- The fully rendered template.
347
348
349=back
350
351
352
353
354=back
355
356    render($tmpl, $data, $partials) # => String
357
358=over
359
360
361Renders the given template with the given data.  Partials will be looked
362up in the given hash.
363
364
365
366Parameters:
367
368=over
369
370=item *
371
372(I<<<< String >>>>) B<<<<< C<<<< $tmpl >>>> >>>>> -- The template to
373render.
374
375
376=item *
377
378(I<<<< Hash, Class, Object >>>>) B<<<<< C<<<< $data >>>> >>>>> --
379Data to be interpolated into the template.
380
381
382=item *
383
384(I<<<< Hash >>>>) B<<<<< C<<<< $partials >>>> >>>>> -- A hash
385containing partials.
386
387
388=back
389
390
391Returns:
392
393=over
394
395=item *
396
397(I<<<< String >>>>) -- The fully rendered template.
398
399
400=back
401
402
403
404
405=back
406
407=item B<<<< template >>>>
408
409    template($receiver) # => String
410
411
412Reads the template off disk.
413
414
415
416
417Returns:
418
419=over
420
421=item *
422
423(I<<<< String >>>>) -- The contents of the L<<<< S<<<<<
424template_file >>>>>|template_file >>>> under L<<<< S<<<<<
425template_path >>>>>|template_path >>>>.
426
427
428=back
429
430=item B<<<< template_extension >>>>
431
432    template_extension # => String
433
434
435File extension for templates and partials.
436
437
438
439
440Returns:
441
442=over
443
444=item *
445
446(I<<<< String >>>>) -- C<<<< $Template::Mustache::template_extension
447>>>> (defaults to 'mustache').
448
449
450=back
451
452=item B<<<< template_file >>>>
453
454    template_file($receiver) # => String
455
456
457The template filename to read.  The filename follows standard Perl
458module lookup practices (e.g. My::Module becomes My/Module.pm) with the
459following differences:
460
461
462=over
463
464=item *
465
466Templates have the extension given by L<<<< S<<<<< template_extension
467>>>>>|template_extension >>>> ('mustache' by default).
468
469
470=item *
471
472Templates will have L<<<< S<<<<< template_namespace
473>>>>>|template_namespace >>>> removed, if it appears at the beginning of
474the package name.
475
476
477=item *
478
479Template filename resolution will short circuit if C<<<<
480$Template::Mustache::template_file >>>> is set.
481
482
483=item *
484
485Template filename resolution may be overriden in subclasses.
486
487
488=item *
489
490Template files will be resolved against L<<<< S<<<<< template_path
491>>>>>|template_path >>>>, not C<<<< $PERL5LIB >>>>.
492
493
494=back
495
496
497
498
499
500Returns:
501
502=over
503
504=item *
505
506(I<<<< String >>>>) -- The path to the template file, relative to
507L<<<< S<<<<< template_path >>>>>|template_path >>>>.
508
509
510=back
511
512See Also:
513
514=over
515
516=item *
517
518L<<<< S<<<<< template >>>>>|template >>>>
519
520
521=back
522
523=item B<<<< template_namespace >>>>
524
525    template_namespace # => String
526
527
528Package namespace to ignore during template lookups.
529
530As an example, if you subclass C<<<< Template::Mustache >>>> as the
531class C<<<< My::Heavily::Namepaced::Views::SomeView >>>>, calls to L<<<<
532S<<<<< render >>>>>|render >>>> will automatically try to load the
533template C<<<< ./My/Heavily/Namespaced/Views/SomeView.mustache >>>>
534under the L<<<< S<<<<< template_path >>>>>|template_path >>>>. Since
535views will very frequently all live in a common namespace, you can
536override this method in your subclass, and save yourself some headaches.
537
538   Setting template_namespace to:      yields template name:
539     My::Heavily::Namespaced::Views => SomeView.mustache
540     My::Heavily::Namespaced        => Views/SomeView.mustache
541     Heavily::Namespaced            =>
542My/Heavily/Namespaced/Views/SomeView.mustache
543
544As noted by the last example, namespaces will only be removed from the
545beginning of the package name.
546
547
548
549
550Returns:
551
552=over
553
554=item *
555
556(I<<<< String >>>>) -- The empty string.
557
558
559=back
560
561=item B<<<< template_path >>>>
562
563    template_path # => String
564
565
566Filesystem path for template and partial lookups.
567
568
569
570
571Returns:
572
573=over
574
575=item *
576
577(I<<<< String >>>>) -- C<<<< $Template::Mustache::template_path >>>>
578(defaults to '.').
579
580
581=back
582
583=back
584
585=head1 AUTHOR
586
587Pieter van de Bruggen
588
589