File: Formatter.pm

package info (click to toggle)
libhtml-template-compiled-perl 0.97-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 756 kB
  • sloc: perl: 4,504; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package HTML::Template::Compiled::Formatter;
# $Id: Formatter.pm 750 2006-10-11 21:52:24Z tinita $
use strict;
use warnings;
our $VERSION = "0.01";

use base 'HTML::Template::Compiled';

use vars qw($formatter);

1;

__END__

=head1 NAME

HTML::Template::Compiled::Formatter - HTC subclass for using a formatter

=head1 SYNOPSIS

    my $formatter = {
        'HTC::Class1' => {
            fullname => sub {
                $_[0]->first . ' ' . $_[0]->last
            },
            first => HTC::Class1->can('first'),
            last => HTC::Class1->can('last'),
        },
    };
    my $htc = HTML::Template::Compiled::Formatter->new(
        path => 't/templates',
        filename => 'formatter.htc',
        debug => 0,
    );
    my $obj = bless ({ first => 'Abi', last => 'Gail'}, 'HTC::Class1');

    $htc->param(
        test => 23,
        obj => $obj,
    );
    local $HTML::Template::Compiled::Formatter::formatter = $formatter;
    my $out = $htc->output;


=cut