河野真治 @ 琉球大学情報工学です。

XS をひさしぶりに書いて、h2xs とかと遊んでいたんですが...

t でも書くか... use Test; ふーん。
   perldoc -m Test
って、module source そのものじゃん。えーと、
   perldoc perldoc
ふーん、-t かぁ。
   perldoc  Test
なんだ、これ通るようになったのか..
   perldoc kill
No documentation found for "kill".
あ、function はだめなのね。まぁ、いいや。(perldoc -f kill は知ってます)

   perldoc  Test
       STOP! If you are writing a new test, we highly suggest you use the new
       Test::Simple and Test::More modules instead.

ふーん、

   perldoc  Test::More
       STOP! If you're just getting started writing tests, have a look at
       Test::Simple first.  This is a drop in replacement for Test::Simple
       which you can switch to once you get the hang of basic testing.

ふーん、

   perldoc  Test::Simple
       ** If you are unfamiliar with testing read Test::Tutorial first! **

ふーん、
   perldoc -m Test::Tutorial
No module found for "Test::Tutorial".

えーい、

   perldoc Test::Tutorial

       AHHHHHHH!!!!  NOT TESTING!  Anything but testing!  Beat me, whip me,
       send me to Detroit, but don't make me write tests!

       *sob*

       Besides, I don't know how to write the damned things.

       Is this you?  Is writing tests right up there with writing documenta-
       tion and having your fingernails pulled out?  Did you open up a test
       and read

           ######## We start with some black magic

       and decide that's quite enough for you?

       It's ok.  That's all gone now.  We've done all the black magic for you.
       And here are the tricks...

あ、そうですか。

こんな風に書くと、また、威力業務妨害だとか怒る人もいるかも知れないので、
一応、文句ではないと言っておきますが...

まぁ、どうせ、おんなじ奴が書いたんだと思うけど、この「右を見ろ」
的な joke ってどこにでもあるのね〜  そんだけ。

(結局、この先のドキュメントは読まずにすませたのは内緒)

そういえば、perlxs には、

       The "length(NAME)" Keyword

       If one of the input arguments to the C function is the length of a
       string argument "NAME", one can substitute the name of the length-argu-
       ment by "length(NAME)" in the XSUB declaration.  This argument must be
       omited when the generated Perl function is called.  E.g.,

         MODULE = x            PACKAGE = x

         void dump_chars(char *s, short length(s))

とか書いてあるけど、なんか通らなかったな。便利そうだったのに。
結局、SvPVbyte で書いたのでいいんだけど。

あぁ、そうか。これって、直接呼び出す C function だけに使える
のか。XSの中で定義する関数に使ってはいけないみたいですね。

と、自己完結しました...  XS には謎が多い...

---
Shinji KONO @ Information Engineering, University of the Ryukyus
河野真治 @ 琉球大学工学部情報工学科