Skip to content

Instantly share code, notes, and snippets.

@nperez
Created November 17, 2009 03:54
Show Gist options
  • Save nperez/236625 to your computer and use it in GitHub Desktop.
Save nperez/236625 to your computer and use it in GitHub Desktop.
use 5.010;
use MooseX::Declare;
class Blarg
{
use MooseX::NonMoose;
use Template::Declare::Tags('HTML');
extends 'Template::Declare';
method foo(ClassName $class: Int $thing) { div { p { "My thing is: $thing" } } }
around foo(ClassName $class: Int $thing) { div { attr { class => 'wrapper'}; $class->$orig($thing); } }
template foo => \&foo
}
Template::Declare->init( dispatch_to => ['Blarg'] );
say Template::Declare->show( 'foo', 2 );
__END__
produces:
<div class="wrapper">
<div>
<p>My thing is: 2</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment