Hatena::Groupcatalyst

LAPISLAZULI HILL#Catalyst このページをアンテナに追加 RSSフィード

2007-01-05

[][]Chain#04 Chain#04 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Chain#04 - LAPISLAZULI HILL#Catalyst Chain#04 - LAPISLAZULI HILL#Catalyst のブックマークコメント

こんな感じでどうだろう?

を実現するのに

sub user : Chained('/') PathPart('') CaptureArgs(1) {
    my ($self, $c, $user) = @_;
    $c->stash->{ user } = $user;
}

sub list : Chained('user') PathPart('') Args(0) {
    my ($self, $c) = @_;
    $c->stash->{ message } = "'s list";
}

sub detail : Chained('user') PathPart('detail') Args(1) {
    my ($self, $c, $url) = @_;
    $c->stash->{ message } = " detail => " .$url;
}

sub add : Chained('user') PathPart('add') Args(1) {
    my ($self, $c, $url) = @_;
    $c->stash->{ message } .= " add url => " .$url;
}

sub edit : Chained('user') PathPart('edit') Args(1) {
    my ($self, $c, $url) = @_;
    $c->stash->{ message } .= " edit url => " .$url;
}

sub del : Chained('user') PathPart('del') Args(1) {
    my ($self, $c, $url) = @_;
    $c->stash->{ message } .= " delete url => " .$url;
}

sub end : ActionClass('RenderView') {
    my ($self, $c) = @_;
    $c->response->body( $c->stash->{ user }.$c->stash->{ message });
}

下の4つは同じ

最後の(url)を/が入っても全部取るならArgsの数の指定をやめればすべて取ってくれる

sub add : Chained('user') PathPart('add') Args {
    my ($self, $c, @url) = @_;
    $c->stash->{ message } .= " add url => " .join "/", @url;
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /*/add/...                          | /user (1)                            |
|                                     | => /add                              |
| /*/del/...                          | /user (1)                            |
|                                     | => /del                              |
| /*/detail/...                       | /user (1)                            |
|                                     | => /detail                           |
| /*/edit/...                         | /user (1)                            |
|                                     | => /edit                             |
| /*                                  | /user (1)                            |
|                                     | => /list                             |
'-------------------------------------+--------------------------------------'

ふむ

[][]Chain#03 Chain#03 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Chain#03 - LAPISLAZULI HILL#Catalyst Chain#03 - LAPISLAZULI HILL#Catalyst のブックマークコメント

Catalyst in Chains#02 - LAPISLAZULI HILL#Catalyst - Catalystグループの役に立たないメモの続き

Chained('/')

明示的に書いたほうがいいかも

sub language : Chained('/') PathPart('') CaptureArgs(1) {
    my ($self, $c, $language) = @_;
    $c->stash->{language} = $language;
}

それはともかく自分で読み返してみて,やっぱり全くわかってないことがわかったのでちゃんとドキュメントとか読む

マニュアルの(hallo/*/world/*)

http://search.cpan.org/dist/Catalyst-Runtime/lib/Catalyst/DispatchType/Chained.pm

sub hello : Chained('/') PathPart('hello') CaptureArgs(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } = "Hello ";
    $c->stash->{ arg_sum } = $int;
}

sub world : Chained('hello') PathPart('world') Args(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } .= "World!";
    $c->stash->{ arg_sum } += $int;

    $c->response->body( join "<br/>\n",
                        $c->stash->{ message },
                        $c->stash->{ arg_sum },);
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /hello/*/world/*                    | /hello (1)                           |
|                                     | => /world                            |
'-------------------------------------+--------------------------------------'

http://localhost:3000/hello/12345/world/67890

Hello World!
80235

ふむ.引数ごとに処理をして動作ができる

処理を増やす(foo/*/bar/* x2)

sub math : Chained('/') PathPart('math') CaptureArgs(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } = "Math?: $int";
    $c->stash->{ arg_sum } = $int;
}

sub plus : Chained('math') PathPart('plus') Args(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } .= " + $int";
    $c->stash->{ arg_sum } += $int;
}

sub minus : Chained('math') PathPart('minus') Args(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } .= " - $int";
    $c->stash->{ arg_sum } -= $int;
}

sub end : ActionClass('RenderView') {
    my ($self, $c) = @_;
    $c->response->body( join "<br/>\n",
                        $c->stash->{ message },
                        $c->stash->{ arg_sum },);
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /math/*/minus/*                     | /math (1)                            |
|                                     | => /minus                            |
| /math/*/plus/*                      | /math (1)                            |
|                                     | => /plus                             |
'-------------------------------------+--------------------------------------'

増えてる

http://colinux:3000/math/12345/plus/67890

Math?: 12345 + 67890
80235

http://colinux:3000/math/12345/minus/67890

Math?: 12345 - 67890
-55545

ああ,これはathPart('')にしたらさいしょのといっしょだなぁ


最後の引数を指定しないのも取る(foo/*/bar, foo/*/bar/*)

別の例にしたほうがいいかも知れないけど強引に

sub math : Chained('/') PathPart('math') CaptureArgs(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } = "Math?: $int";
    $c->stash->{ arg_sum } = $int;
}

sub plus : Chained('math') PathPart('plus') Args(1) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } .= " + $int";
    $c->stash->{ arg_sum } += $int;
}

sub plus_zero : Chained('math') PathPart('plus') Args(0) {
    my ($self, $c, $int) = @_;
    $c->stash->{ message } .= " + 0";
}

sub end : ActionClass('RenderView') {
    my ($self, $c) = @_;
    $c->response->body( join "<br/>\n",
                        $c->stash->{ message },
                        $c->stash->{ arg_sum },);
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /math/*/plus/*                      | /math (1)                            |
|                                     | => /plus                             |
| /math/*/plus                        | /math (1)                            |
|                                     | => /plus_zero                        |
'-------------------------------------+--------------------------------------'

ひとつ目はさっきといっしょ

http://colinux:3000/math/12345/plus

Math?: 12345 + 0
12345

さいしょのに加えて引数がない場合は別の動作ができると

[][]Catalyst in Chains#02 Catalyst in Chains#02 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Catalyst in Chains#02 - LAPISLAZULI HILL#Catalyst Catalyst in Chains#02 - LAPISLAZULI HILL#Catalyst のブックマークコメント

Chain#01 - LAPISLAZULI HILL#Catalyst - Catalystグループの役に立たないメモの続き

Chainedをふたつ(NG)

ちょっと強引だけどこんなのはどうだ

sub fromlanguage : Chained PathPart('') CaptureArgs(1) {
    my ($self, $c, $fromlanguage) = @_;
    $c->stash->{fromlanguage}   = $fromlanguage;
}

sub language : Chained PathPart('fromlanguage') CaptureArgs(1) {
    my ($self, $c, $language) = @_;
    $c->stash->{language}   = $language;
}

sub show_hoge : Chained('fromlanguage') Chained('language') PathPart('hoge') Args(1) {
    my ($self, $c, $args) = @_;
    $c->response->body( $c->stash->{fromlanguage} ." from " .$c->stash->{language} .": hoge : $args");
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /*/hoge/*                           | /fromlanguage (1)                    |
|                                     | => /show_hoge                        |
'-------------------------------------+--------------------------------------'

動くけど思ったのとは違う

あえてこんなのは?

sub fromlanguage : Chained PathPart('') CaptureArgs(1) {
    my ($self, $c, $fromlanguage) = @_;
    $c->stash->{fromlanguage}   = $fromlanguage;
}

sub language : Chained PathPart('fromlanguage') CaptureArgs(1) {
    my ($self, $c, $language) = @_;
    $c->stash->{language}   = $language;
}

sub show_hoge : Chained('fromlanguage/language') PathPart('hoge') Args(1) {
    my ($self, $c, $args) = @_;
    $c->response->body( $c->stash->{fromlanguage} ." from " .$c->stash->{language} .": hoge : $args");
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
'-------------------------------------+--------------------------------------'

***空っぽだ!***

CaptureArgsを2にしてみた(*/*/hoge/*)

sub language : Chained PathPart('') CaptureArgs(2) {
    my ($self, $c, $language, $tolanguage) = @_;
    $c->stash->{language}   = $language;
    $c->stash->{tolanguage} = $tolanguage;
}

sub show_hoge : Chained('language') PathPart('hoge') Args(1) {
    my ($self, $c, $args) = @_;
    $c->response->body( $c->stash->{language} . " to " . $c->stash->{tolanguage} .": hoge : $args");
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /*/*/hoge/*                         | /language (2)                        |
|                                     | => /show_hoge                        |
'-------------------------------------+--------------------------------------'

http://localhost:3000/jp/en/hoge/12345

jp to en: hoge : 12345

これがほしかった動作だ!

languageでふたつの引数を取ることができた

PathPartをふたつ(NG)

sub language : Chained PathPart('') CaptureArgs(1) {
    my ($self, $c, $language) = @_;
    $c->stash->{language}   = $language;
}

sub edit_hoge : Chained('language') PathPart('hoge') Args(1) PathPart('edit'){
    my ($self, $c, $args) = @_;
    $c->response->body( $c->stash->{language}  .": hoge : $args : edit");
}
Multiple PathPart attributes not supported registering edit_hoge at /home/lapis25/perl/lib/Catalyst/Dispatcher.pm line 409
Compilation failed in require at script/myapp_server.pl line 53.

これはエラーになる.確かに意味は無いな.Argsを2にするんだろう

ddeqcaddeqca2007/04/11 12:47<a href=http://roccofoloper.sblog.cz>sauna belt</a> sauna belt http://roccofoloper.sblog.cz sauna belt

トラックバック - http://catalyst.g.hatena.ne.jp/lapis25/20070105

2007-01-04

[][]Chain#01 Chain#01 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Chain#01 - LAPISLAZULI HILL#Catalyst Chain#01 - LAPISLAZULI HILL#Catalyst のブックマークコメント

役に立たないメモ.

なんかよくわからないのでいろいろやってみる.あとでまとめられたらイイナ

[参考]

まず試して見る(/*/hoge/*, /*/hoge/*/*)

ゆーすけべー日記をまず参考に

sub language : Chained PathPart('') CaptureArgs(1) {
    my ($self, $c, $language) = @_;
    $c->stash->{language} = $language;
}

sub show_hoge : Chained('language') PathPart('hoge') Args(1) {
    my ($self, $c, $args) = @_;
    $c->response->body( $c->stash->{language} . ": hoge1 : $args");
}

sub show_hoge2 : Chained('language') PathPart('hoge') Args(2) {
    my ($self, $c, $arg1, $arg2) = @_;
    $c->response->body( $c->stash->{language} . ": hoge2 : $arg1 : $arg2");
}
[debug] Loaded Chained actions:
.-------------------------------------+--------------------------------------.
| Path Spec                           | Private                              |
+-------------------------------------+--------------------------------------+
| /*/hoge/*                           | /language (1)                        |
|                                     | => /show_hoge1                       |
| /*/hoge/*/*                         | /language (1)                        |
|                                     | => /show_hoge2                       |
'-------------------------------------+--------------------------------------'

hogeのあとのargsが数によってそれぞれ対応するメソッドが呼び出された

http://localhost:3000/en/hoge/12345

en: hoge1 : 12345

http://localhost:3000/en/hoge/12345/67890

en: hoge2 : 12345 : 67890
トラックバック - http://catalyst.g.hatena.ne.jp/lapis25/20070104

2006-11-10

[][]アプリケーション内のurl生成 アプリケーション内のurl生成 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - アプリケーション内のurl生成 - LAPISLAZULI HILL#Catalyst アプリケーション内のurl生成 - LAPISLAZULI HILL#Catalyst のブックマークコメント

$c->uri_forを使用する

my $hogeurl = $c->uri_for('hoge/');

[][]Path_infoの取得 Path_infoの取得 - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Path_infoの取得 - LAPISLAZULI HILL#Catalyst Path_infoの取得 - LAPISLAZULI HILL#Catalyst のブックマークコメント

$c->req->argumentsから取得しなくても,いつもの$self, $cのあとに変数を指定しておけばそこにセットされる

sub url_create : Local {
    my ($self, $c, $title, $rating, $author_id) = @_;
}
トラックバック - http://catalyst.g.hatena.ne.jp/lapis25/20061110

2006-11-01

[][][]Scaffold Scaffold - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Scaffold - LAPISLAZULI HILL#Catalyst Scaffold - LAPISLAZULI HILL#Catalyst のブックマークコメント

Ruby on Railsのサンプルでよく出てくるScaffold.Viewごとにある.何も付いてないのがtt用

http://www.tcool.org/catalyst/Cookbook.html#Scaffolding

no title←tt

no title

no title

ひとまずインストール終了

HenryStadOHenryStadO2018/07/21 21:43Привет! Класный у вас сайт!
Нашёл познавательное в сети:
http://enewz.ru/news/10378-feygin-internet-akciya-v-podderzhku-savchenko-garantiruet-obsuzhdenie-ee-dela-na-vstreche-v-astane.html <b> Фейгин: Интернет-акция в поддержку Савченко гарантирует обсуждение её дела на встрече в Астане </b>
http://enewz.ru/news/478-nahodyas-za-granicey-luzhkov-nachal-izoblichat-samye-ubiystvennye-sekrety-medvedeva.html
http://enewz.ru/news/9188-semerak-predrekaet-ukraine-sudbu-singapura-i-yuzhnoy-korei.html
Ещё много всего по теме нашел тут: <b> </b> http://enewz.ru/

IrvingabofeIrvingabofe2018/09/05 17:25Привет всем!
Нашел интересные фотоподборки на этом сайте: http://coolsoda.ru :
<a href=http://coolsoda.ru/foto-prikoly-interesnoe/3496-10-samyh-kroshechnyh-naselennyh-ostrovov-mira.html> 10 самых крошечных населённых островов мира </a>
<b> Самые невероятные мистификации </b> http://coolsoda.ru/foto-prikoly-interesnoe/772-samye-neveroyatnye-mistifikacii.html
http://coolsoda.ru/foto-prikoly-interesnoe/2714-penthaus-za-100-millionov.html

JacobacaryJacobacary2018/09/05 20:23Приветствую всех!
Нашел удивительную информацию на этом сайте: http://anubi.ru :
http://anubi.ru/foto-prikoly-interesnoe/4508-doistoricheskie-zhivotnye-zhivshie-na-territorii-rossii.html <b> Доисторические животные, жившие на территории России </b>
http://anubi.ru/foto-prikoly-interesnoe/620-opticheskie-illyuzii-sozdannye-prirodoy.html <b> Оптические иллюзии, созданные природой </b>
http://anubi.ru/foto-prikoly-interesnoe/1585-naberezhnye-chelny-i-avtomobilnyy-zavod-kamaz-s-vysoty.html

JarvisRowJarvisRow2018/09/05 23:02Всем привет!
Нашел познавательную подборку на этом сайте: http://coolrobo.ru :
http://coolrobo.ru/interesnoe/7931-interesnye-fakty-o-severnoy-koree.html <b> Интересные факты о Северной Корее </b>
<a href=http://coolrobo.ru/foto-prikoly-interesnoe/2023-7-strun-russkoy-dushi.html> 7 струн русской души </a>
http://coolrobo.ru/foto-prikoly-interesnoe/382-luchshaya-reklama-2014-goda.html

clubOptonseclubOptonse2018/09/16 06:10In spa center sensual massage master of massage will make best Buttock Massage.
Our masseurs very qualified in order to at the end session trimming massage you experienced yourself easy strikingly and were ready to inconceivable sensual actions. The spa center thai invites visit one of the ways massage techniques, is what we do. The attractive girls our the salon will give you an unforgettable experience. The spa center is a place of rest and relaxation.
Spa center in Gotham we recommend wonderful rooms with convenient decoration. These quarters can help to stay with you incognito.
Affectionate virgins will make you Prostate massage and anticellulite massage, you can choose the right one several varieties massage on your solution. Success organization Bamboo Erotic Massage is at, so that, in first you received from of this buzz.
Soft touching beautiful masters of massage will flow through your body, immersing in depth boundless the ocean pleasure. In the unhurried slip, rewarding your body kisses, a charming envelops the warmth of one's body. You will be surprised at, which sea bliss possible to feel fromgrooming massage in N.Y.C.


We work in Manhattan. Masseuses Madison
<a href=https://parlour.massage-manhattan-club.com>massage room</a>

RobertsapRobertsap2018/09/17 03:42Привет всем!
Нашел приколы с Фото на этом сайте: http://limonos.ru :
http://limonos.ru/foto-prikoly-interesnoe/2504-maska-gaya-foksa.html <b> Маска Гая Фокса </b>
<a href=http://limonos.ru/foto-prikoly-interesnoe/5954-veselenkie-grobiki.html> Веселенькие гробики </a>
http://limonos.ru/foto-prikoly-interesnoe/7259-pochemu-ikona-stilya-irina-ponarovskaya-ushla-so-sceny.html

RolandGrortRolandGrort2018/09/18 09:36Привет всем!
Нашел интересную подборку на этом сайте: http://himaan.ru :
http://himaan.ru/foto-prikoly-interesnoe/4116-posledstviya-razliva-nefti-v-kalifornii.html <b> Последствия разлива нефти в Калифорнии </b>
<a href=http://himaan.ru/foto-prikoly-interesnoe/5292-dom-na-kolesah-iz-starogo-shkolnogo-avtobusa.html> Дом на колесах из старого школьного автобуса </a>
http://himaan.ru/foto-prikoly-interesnoe/3514-portrety-muzykantov-na-scene-ot-alexandre-fumeron.html

LancePlatoLancePlato2018/09/23 16:06Привет всем участникам форума!
Нашел приколы с Фото на этом сайте: http://okaybro.ru :
<a href=http://okaybro.ru/foto-prikoly-interesnoe/383-20-simvolov-shotlandii.html> 20 символов Шотландии </a>
<b> Старые немецкие города Калининградской области </b> http://okaybro.ru/foto-prikoly-interesnoe/2160-starye-nemeckie-goroda-kaliningradskoy-oblasti.html
http://okaybro.ru/foto-prikoly-interesnoe/699-yaguar-ppobedal-kaymanom.html

トラックバック - http://catalyst.g.hatena.ne.jp/lapis25/20061101

2006-10-27

[][]Data::Page::Navigation Data::Page::Navigation - LAPISLAZULI HILL#Catalyst を含むブックマーク はてなブックマーク - Data::Page::Navigation - LAPISLAZULI HILL#Catalyst Data::Page::Navigation - LAPISLAZULI HILL#Catalyst のブックマークコメント

no title

これは良いものです

<div>
[% IF pager.previous_page %]
[% IF pager.first_page != pager.previous_page %]
<a href="?page=[% pager.first_page %]">&laquo;</a>
[% END %]
<a href="?page=[% pager.previous_page %]">&lsaquo;</a>
[% END %]

[% FOREACH num = pager.pages_in_navigation(9) %]
[% IF num == pager.current_page %]
<span class="current_page">[% num %]</span>
[% ELSE %]
<a href="?page=[% num %]">[% num %]</a>
[% END %]
[% END %]

[% IF pager.next_page %]
<a href="?page=[% pager.next_page %]">&rsaquo;</a>
[% IF pager.last_page != pager.next_page %]
<a href="?page=[% pager.last_page %]">&raquo;</a>
[% END %]
[% END %]
</div>

myApp.pmでuse Data::Page::Navigationしてみたけどそれでいいのかな.ひとまず動いてるしいいか…

LuisLuis2012/07/21 21:34That really captures the spirit of it. Thanks for psotnig.

exexqoawbsaexexqoawbsa2012/07/22 18:51zO7SeF <a href="http://jwylgqfwuqlm.com/">jwylgqfwuqlm</a>

rgintqetprgintqetp2012/07/23 08:376pdE8n , [url=http://hgpgalwxfxzc.com/]hgpgalwxfxzc[/url], [link=http://weuoautyjcnb.com/]weuoautyjcnb[/link], http://tlbructurbvi.com/

boanjjoumboanjjoum2012/07/24 12:42nsyvQ2 , [url=http://ubebvftzmbfs.com/]ubebvftzmbfs[/url], [link=http://zueulzhwavbt.com/]zueulzhwavbt[/link], http://xjrgfbupxcoe.com/