Hatena::Groupcatalyst

dann@catalyst このページをアンテナに追加 RSSフィード

2008-05-01

MooseのMeta Attributeの仕組みはBread::Boardへのサービスの自動登録に使えそう!

MooseのMeta Attributeの仕組みはBread::Boardへのサービスの自動登録に使えそう! - dann@catalyst を含むブックマーク はてなブックマーク - MooseのMeta Attributeの仕組みはBread::Boardへのサービスの自動登録に使えそう! - dann@catalyst MooseのMeta Attributeの仕組みはBread::Boardへのサービスの自動登録に使えそう! - dann@catalyst のブックマークコメント

Bread::Boardだと、以下のようにdependenciesを書かないといけないですが、この部分を独立したファイルに書くのは、個人的にはあまりよい方法ではないんじゃないかなぁと思います。

             service ’application’ => (
                 class        => ’MyApplication’,
                 dependencies => {
                     logger => depends_on(’logger’),
                     dbh    => depends_on(’Database/dbh’),
                 }
             );

何故、これがよくないかというと、冗長だからです。

Mooseで作るクラスでは、

package MyApplication;
use Moose;
has 'logger' ...

と記述するわけで、loggerに依存しているというのは、そのクラスをみればわかります。知りたいのは実装クラスが何か、要するにloggerを実装したクラスが何か?というのがだけがわかればよいわけです。

ですから、Bread::Boardのように記述するのではなくて、コンテナ側に登録するコードで書くのではなくて、injectされる側のAttributeに何をinjectするのかを明示させたほうがいいだろうなと思っています。

以下のようにして、Serviceの登録部分は自動でするというのが、いいんだろうなぁと思いました。

  • lib/MyApp/Service/* をざっとなめて、serviceクラスをリストアップ
  • dependenciesは、各クラスのhasに書かれたattributeからinjectしたい実装クラスをinject

Attributeの追加とあるAttributeのついたもの取得は、以下のCookbookにある方法でできることがわかりました。via yappo さんblog

http://search.cpan.org/~stevan/Moose/lib/Moose/Cookbook/Recipe21.pod

ということで、上記のことも実現できるじゃん!と思っていたのでした。Mooseかわいいよ、Moose。

ogovutetogovutet2018/03/23 19:11http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

oxevebapoxevebap2018/03/23 19:15http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

oqevoxioqevoxi2018/03/23 19:19http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

ekdeburohtejuekdeburohteju2018/03/23 19:26http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

viewwawivabukviewwawivabuk2018/03/23 19:28http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

uzufuguuzufugu2018/03/23 19:33http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

ehubudiehubudi2018/03/23 19:34http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

aeseciyomeoaeseciyomeo2018/03/23 19:43http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

goxevungoxevun2018/03/23 19:46http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

okfatunefizokfatunefiz2018/03/23 19:47http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

iwetevaviwetevav2018/03/23 19:50http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

axeuropaqipeaxeuropaqipe2018/03/23 19:57http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

ujovuvojujovuvoj2018/03/23 20:04http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

guvojuxomatefguvojuxomatef2018/03/23 23:07http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

iwufyuliwufyul2018/03/23 23:23http://doxycycline-cheapbuy.site/ - doxycycline-cheapbuy.site.ankor <a href="http://onlinebuycytotec.site/">onlinebuycytotec.site.ankor</a> http://tadalafilcialis-cheapestprice.site/

KevinpesKevinpes2018/08/28 13:40Sexual relationship is often a pleasurable give to get relationship with one?s partner. If anything goes wrong with this cooperation process, it is enough to derail their bond. But anything can occur and that's unpredictable. Moreover, able to keep a normal sexual relationship means keeping oneself physically healthy. So any kind of sexual disfunction must be helped by utmost care. One such hazard to health is erection dysfunction commonly seen in men. Unable to keep a proper and prolonged penile erection leads to male impotence. This is infact a serious problem for maintaining a proper sexual relationship. So when there arises a real problem it?s smart to treat it in lieu of sitting quiet.

The choice involving the various available treatment plans involve treatment which has a proper medicine. Response to a dental agent such as Levitra can be quite effective on this context. Studies show that erection dysfunction is especially as a result of insufficient blood flow to the penis? veins and deficiency of stimulation at the same time. Practising oral therapy of Levitra enhances the rate of the circulation of blood that gradually stimulates the penis producing a hard erection, adequate on an intercourse.



Levitra is but one such drug that's discovered to be very effective. Clinically many experts have proved who's even creates patients who are suffering from various health problems like high blood pressure levels, high cholesterol or diabetes. A lot of men, who took Levitra the first time, responded positively for gaining high success rate. Besides, many experts have also found who's can be also taken to medicines employed to treat other medical ailments.

<a href="https://www.cialispascherfr24.com/cialis-super-active-20mg/">https://www.cialispascherfr24.com/cialis-super-active-20mg/</a>