summaryrefslogtreecommitdiff
path: root/_posts/2009-11-09-modules-i-like-devel-declare.md
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--_posts/2009-11-09-modules-i-like-devel-declare.md (renamed from _posts/2009-11-09-modules-i-like-devel-declare.textile)18
1 files changed, 9 insertions, 9 deletions
diff --git a/_posts/2009-11-09-modules-i-like-devel-declare.textile b/_posts/2009-11-09-modules-i-like-devel-declare.md
index 79f7bf5..bd435e3 100644
--- a/_posts/2009-11-09-modules-i-like-devel-declare.textile
+++ b/_posts/2009-11-09-modules-i-like-devel-declare.md
@@ -1,10 +1,10 @@
---
layout: post
-category: perl
+summary: In which I share my enthusiasm for Devel::Declare.
title: Modules I like Devel::Declare
---
-For "$work":http://linkfluence.net/, I've been working on a job queue system, using Moose, Catalyst (for a REST API) and DBIx::Class to store the jobs and some meta (yeah I know, there is not enough job queue system already, the world really needs a new one ...).
+For [$work](http://linkfluence.net/), I've been working on a job queue system, using Moose, Catalyst (for a REST API) and DBIx::Class to store the jobs and some meta (yeah I know, there is not enough job queue system already, the world really needs a new one ...).
Basicaly, I've got a XXX::Worker class that all the workers extends. This class provide methods for fetching job, add a new job, mark a job as fail, retry, ...
@@ -39,7 +39,7 @@ sub foo {
But as I'm using Moose, I want to add more sugar to the syntax, so writing a new worker would be really more easy.
-Here comes "Devel::Declare":http://search.cpan.org/perldoc?Devel::Declare.
+Here comes [Devel::Declare](http://search.cpan.org/perldoc?Devel::Declare).
The syntax I want for my worker is this one:
@@ -62,9 +62,9 @@ fail bar {
};
{% endhighlight %}
-Where with '*work*' I write the code the writer will execute on a task, '*success*', a specific code that will be executed after a job is marked as successfull, and '*fail*' for when the job fail.
+Where with `work` I write the code the writer will execute on a task, `success`, a specific code that will be executed after a job is marked as successfull, and `fail` for when the job fail.
-I will show how to add the '*work*' keyword. I start by writing a new package:
+I will show how to add the `work` keyword. I start by writing a new package:
{% highlight perl %}
package XXX::Meta;
@@ -97,9 +97,9 @@ sub init_meta {
1;
{% endhighlight %}
-The *init_meta* method is provided by Moose: (from the POD)
+The `init_meta` method is provided by Moose: (from the POD)
-bq. The *init_meta* method sets up the metaclass object for the class specified by *for_class*. This method injects a a meta accessor into the class so you can get at this object. It also sets the class's superclass to base_class, with Moose::Object as the default.
+> The `init_meta` method sets up the metaclass object for the class specified by `for_class`. This method injects a a meta accessor into the class so you can get at this object. It also sets the class's superclass to base_class, with Moose::Object as the default.
So I inject into the class that will use XXX::Meta a new metaclass, XXX::Meta::Class.
@@ -156,7 +156,7 @@ sub add_local_method {
1;
{% endhighlight %}
-Here I add to the *->meta* provided by Moose '*local_work*', which is an array that contains all my '*work*' methods. So each time I do something like
+Here I add to the `->meta` provided by Moose `local_work`, which is an array that contains all my `work` methods. So each time I do something like
{% highlight perl %}
work foo {};
@@ -224,7 +224,7 @@ sub parser {
1;
{% endhighlight %}
-The *install_methodhandler* add the *work* keyword, with a block of code. This code is sent to the parser, that will add more sugar. With the inject_if_block, I inject the following line
+The `install_methodhandler` add the `work` keyword, with a block of code. This code is sent to the parser, that will add more sugar. With the inject_if_block, I inject the following line
{% highlight perl %}
my ($self, $context, $job) = @_;