Template-Caribou

 view release on metacpan or  search on metacpan

examples/lib/MyTags.pm  view on Meta::CPAN

use strict;
use warnings;

use Template::Caribou::Utils;

use parent 'Exporter';

our @EXPORT = qw/ my_img /;


sub my_img(&) { render_tag( 'img', sub {
    die "img needs a 'src'" unless $_[0]->{src};
}, shift ) };

1;

t/tags_extended.t  view on Meta::CPAN

open ::RAW, '>', \my $raw;

is do {
    doctype 'html5'
} => "<!DOCTYPE html>\n", 'doctype';

is do { favicon "foo" } => '<link href="foo" rel="shortcut icon" />', 'favicon';

my $bou = Test->new;

sub render_ok(&$$) {
    my ( $template, $expected, $title) = @_;
    is $bou->render($template), $expected, $title;
}

render_ok sub { submit "foo", id => 'bar'; } 
    => '<input id="bar" type="submit" value="foo" />', 'submit';

render_ok sub { css "X" } 
    => '<style type="text/css">X</style>', 'css';



( run in 0.626 second using v1.01-cache-2.11-cpan-49f99fa48dc )