Skip to content

Instantly share code, notes, and snippets.

@phaylon
Created May 31, 2010 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phaylon/420295 to your computer and use it in GitHub Desktop.
Save phaylon/420295 to your computer and use it in GitHub Desktop.
# declaration:
class Foo {
with 'App::StaticPressure::API::Factory' => {
classes => {
parser => 'Markdent::Parser',
handler => {
default => 'App::StaticPressure::Engine::Markdown::Handler',
build_args => sub { title => 'none' },
},
},
};
# same as $self->handler_class->new(title => 'none', foo => 23);
method make_handler (%args) {
return $self->_new_handler(foo => 23);
}
}
# usage:
# 'Markdent::Parser'
say Foo->new->parser_class;
# 'My::Parser'
say Foo->new(parser_class => 'My::Parser')->parser_class;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment