| 1 | package Template::Lace::Utils; | ||
| 2 | |||
| 3 | 1 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Template::Lace::ComponentCallback; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | our @EXPORT_OK = (qw/mk_component/); | |
| 7 | 1 | our %EXPORT_TAGS = (All => \@EXPORT_OK, ALL => \@EXPORT_OK); | |
| 8 | |||
| 9 | 1 | ▶ | sub mk_component(&) { return Template::Lace::ComponentCallback->new(@_) } |
|
Subroutine
mk_component: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 10 | |||
| 11 | 1 | 1; | |
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | Template::Lace::Utils - Utility Methods | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | TBD | ||
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | A collection of helpful utility methods | ||
| 24 | |||
| 25 | =head1 mk_component | ||
| 26 | |||
| 27 | Make a callback component. See L<Template::Lace::ComponentCallback>. Example: | ||
| 28 | |||
| 29 | use Template::Lace::Utils 'mk_component'; | ||
| 30 | my $factory = Template::Lace::Factory->new( | ||
| 31 | model_class=>'Local::Template::User', | ||
| 32 | component_handlers=>+{ | ||
| 33 | tag => { | ||
| 34 | anchor => mk_component { | ||
| 35 | my ($self, %attrs) = @_; | ||
| 36 | return "<a href='$_{href}' target='$_{target}'>$_{content}</a>"; | ||
| 37 | }, | ||
| 38 | }, | ||
| 39 | }, | ||
| 40 | ); | ||
| 41 | |||
| 42 | |||
| 43 | =head1 SEE ALSO | ||
| 44 | |||
| 45 | L<Template::Lace>. | ||
| 46 | |||
| 47 | =head1 AUTHOR | ||
| 48 | |||
| 49 | Please See L<Template::Lace> for authorship and contributor information. | ||
| 50 | |||
| 51 | =head1 COPYRIGHT & LICENSE | ||
| 52 | |||
| 53 | Please see L<Template::Lace> for copyright and license information. | ||
| 54 | |||
| 55 | =cut | ||