diff options
| author | fukachan <fukachan> | 2002-02-16 13:23:24 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-02-16 13:23:24 +0000 |
| commit | 2e5db4222285e23796d24f1fe22a9344413d6a75 (patch) | |
| tree | 9a4803be88120f4a3a711ec0185530ce5ba9ab46 /fml/doc/ja/tutorial | |
| parent | dc70918d70e082fb7b5a83ceaa9e7c1ad80c1509 (diff) | |
| download | fml8-2e5db4222285e23796d24f1fe22a9344413d6a75.tar.gz fml8-2e5db4222285e23796d24f1fe22a9344413d6a75.tar.bz2 fml8-2e5db4222285e23796d24f1fe22a9344413d6a75.zip | |
add chapter on hook
Diffstat (limited to 'fml/doc/ja/tutorial')
| -rw-r--r-- | fml/doc/ja/tutorial/book.sgml | 5 | ||||
| -rw-r--r-- | fml/doc/ja/tutorial/include/chapters.ent | 3 | ||||
| -rw-r--r-- | fml/doc/ja/tutorial/internals/hook.sgml | 88 |
3 files changed, 94 insertions, 2 deletions
diff --git a/fml/doc/ja/tutorial/book.sgml b/fml/doc/ja/tutorial/book.sgml index 4cb28c20..949ed535 100644 --- a/fml/doc/ja/tutorial/book.sgml +++ b/fml/doc/ja/tutorial/book.sgml @@ -2,7 +2,7 @@ This is an sgml using DocBook dtd. Use sgmltools version 2.0.x or above to generate various output formats. -$FML: book.sgml,v 1.27 2001/11/25 12:03:23 fukachan Exp $ +$FML: book.sgml,v 1.28 2002/02/13 13:51:50 fukachan Exp $ --> <!doctype book public "-//FML//DTD DocBook V3.1-Based Extension//EN" [ @@ -96,6 +96,9 @@ $FML: book.sgml,v 1.27 2001/11/25 12:03:23 fukachan Exp $ <!-- セキュリティ --> &chapter.restriction; + <!-- フック --> + &chapter.hook; + <!-- その他 --> &chapter.db; &chapter.dbms; diff --git a/fml/doc/ja/tutorial/include/chapters.ent b/fml/doc/ja/tutorial/include/chapters.ent index c2e1e15a..7cd2070b 100644 --- a/fml/doc/ja/tutorial/include/chapters.ent +++ b/fml/doc/ja/tutorial/include/chapters.ent @@ -1,5 +1,5 @@ <!-- - $FML: chapters.ent,v 1.29 2002/02/02 05:45:26 fukachan Exp $ + $FML: chapters.ent,v 1.30 2002/02/13 13:51:51 fukachan Exp $ --> <!entity versin "1.1"> @@ -49,6 +49,7 @@ <!-- う〜ん、分類は…?;-) --> <!entity chapter.db SYSTEM "internals/db.sgml"> <!entity chapter.dbms SYSTEM "internals/dbms.sgml"> +<!entity chapter.hook SYSTEM "internals/hook.sgml"> <!entity chapter.policy SYSTEM "policy.sgml"> <!-- 配送 --> diff --git a/fml/doc/ja/tutorial/internals/hook.sgml b/fml/doc/ja/tutorial/internals/hook.sgml new file mode 100644 index 00000000..99ccae5d --- /dev/null +++ b/fml/doc/ja/tutorial/internals/hook.sgml @@ -0,0 +1,88 @@ +<!-- + $FML$ +--> + +<chapter id="hook"> + <title> + HOOK + </title> + + +<sect1> + <title> + hook における諸問題 + </title> + +<para> +hook は微妙な、もしくは複雑なカスタマイズのために是非必要です。 +ですが、実装においてはいくつかの問題があります。 +</para> + +<para> +まず、第一に hook の名前に一定の基準が必要です。 +$START_HOOK のような曖昧なものではなく。 +</para> + +<para> +また、HOOK の書き方がしょうしょう良くなくても動くのがよいでしょう。 +通常 +use strict; +になっていますが、 +HOOK を評価する lexical scope では無視するようにするべきでしょう。 +</para> + +</sect1> + + +<sect1> + <title> + hook の命名規則 + </title> + +<para> +hook 名前の標準的な形式については +<screen> +プログラム名_メソッド名_start_hook +プログラム名_メソッド名_end_hook +</screen> +のようにすることにします。 +例えば、fmlconf のメインの部分 run() の HOOK の名前は +<screen> +fmlconf_run_start_hook +fmlconf_run_end_hook +</screen> +となり、run() の中での hook 呼び出しは次のようなコードになります。 +<screen> +sub run +{ + my ($curproc, $args) = @_; + my $config = $curproc->{ config }; + + my $eval = $config->get_hook( 'fmlconf_run_start_hook' ); + if ($eval) { + eval qq{ $eval; }; + print STDERR $@ if $@; + } + + $curproc->_fmlconf($args); + + $eval = $config->get_hook( 'fmlconf_run_end_hook' ); + if ($eval) { + eval qq{ $eval; }; + print STDERR $@ if $@; + } +} +</screen> +</para> + +<para> +現実にはもっといろいろな場所に HOOK がないと不便でしょうが、 +その名前は上述の HOOK 以外に設定します。 +単純に hook2 でいいのかもしれないし、 +可能であればもう少し理解しやすい名前にするべきでしょう。 +</para> + +</sect1> + + +</chapter> |
