Subject: | smart_tab_wrapper clears %ATTRIBUTES Too late |
Date: | Fri, 11 Jul 2008 10:57:43 -0700 |
To: | bug-template-declare [...] rt.cpan.org |
From: | "David E. Wheeler" <dwheeler [...] cpan.org> |
If I have this wrapper sub:
sub wrap(&) {
my $code = shift;
smart_tag_wrapper {
my %p = @_;
html {
head {
title { outs $p{title} };
};
$code->();
div {
outs 'Page last generated at ', scalar gmtime, '.';
};
}
};
}
And then I call it like this:
with( title => 'Book List' ),
wrap { h1 { 'Hello, world!' } };
Then I end up with output like this:
<html title="Book List">
<head>
<title>Book List</title>
</head>
<h1>Hello, world!</h1>
<div>Page last generated at Fri Jul 11 17:55:56 2008.</div>
</html>
Note the 'title="Book List"' attribute in the <html> tag. That
shouldn't be there. I can get around it by calling with() before I
call html{}, but should I have to?
Thanks,
David