1 |
|
2 |
=encoding euc-jp |
3 |
|
4 |
=head1 NAME |
5 |
|
6 |
=begin original |
7 |
|
8 |
perlnewmod - preparing a new module for distribution |
9 |
|
10 |
=end original |
11 |
|
12 |
perlnewmod - 新しいモジュールを配布するには |
13 |
|
14 |
=head1 DESCRIPTION |
15 |
|
16 |
=begin original |
17 |
|
18 |
This document gives you some suggestions about how to go about writing |
19 |
Perl modules, preparing them for distribution, and making them available |
20 |
via CPAN. |
21 |
|
22 |
=end original |
23 |
|
24 |
このドキュメントは、Perl モジュールを書き、配布する準備をして、CPAN を |
25 |
通じて取得可能にするためのアドバイスです。 |
26 |
|
27 |
=begin original |
28 |
|
29 |
One of the things that makes Perl really powerful is the fact that Perl |
30 |
hackers tend to want to share the solutions to problems they've faced, |
31 |
so you and I don't have to battle with the same problem again. |
32 |
|
33 |
=end original |
34 |
|
35 |
Perl が実際にこんなに強力な理由の 1 つとして、Perl ハッカーたちが、自分の |
36 |
直面した問題への解決策を共有しようとしていることが挙げられるでしょう。 |
37 |
だから、みんなが同じ問題に悩む必要はないわけです。 |
38 |
|
39 |
=begin original |
40 |
|
41 |
The main way they do this is by abstracting the solution into a Perl |
42 |
module. If you don't know what one of these is, the rest of this |
43 |
document isn't going to be much use to you. You're also missing out on |
44 |
an awful lot of useful code; consider having a look at L<perlmod>, |
45 |
L<perlmodlib> and L<perlmodinstall> before coming back here. |
46 |
|
47 |
=end original |
48 |
|
49 |
これが実現されているのは、多くの場合あるソリューションを抽象化して、 |
50 |
Perl モジュールにしているということです。 |
51 |
もしこれがなんのことかわからなければ、このドキュメントの残りはあまり |
52 |
役には立たないでしょうし、今までにたくさんの便利なコードを |
53 |
見逃していることでしょう。 |
54 |
L<perlmod>, L<perlmodlib>, L<perlmodinstall> をよく読んで、ここに戻って |
55 |
来てください。 |
56 |
|
57 |
=begin original |
58 |
|
59 |
When you've found that there isn't a module available for what you're |
60 |
trying to do, and you've had to write the code yourself, consider |
61 |
packaging up the solution into a module and uploading it to CPAN so that |
62 |
others can benefit. |
63 |
|
64 |
=end original |
65 |
|
66 |
もし、あなたがやるべきことに関するモジュールが存在せず、自分でコードを |
67 |
書かないといけないとなったときには、そのソリューションをモジュールに |
68 |
詰め込んで CPAN にアップロードすることを検討してください。 |
69 |
そうすれば、他のみんなの利益になります。 |
70 |
|
71 |
=head2 Warning |
72 |
|
73 |
(警告) |
74 |
|
75 |
=begin original |
76 |
|
77 |
We're going to primarily concentrate on Perl-only modules here, rather |
78 |
than XS modules. XS modules serve a rather different purpose, and |
79 |
you should consider different things before distributing them - the |
80 |
popularity of the library you are gluing, the portability to other |
81 |
operating systems, and so on. However, the notes on preparing the Perl |
82 |
side of the module and packaging and distributing it will apply equally |
83 |
well to an XS module as a pure-Perl one. |
84 |
|
85 |
=end original |
86 |
|
87 |
ここでは主にピュア Perl のモジュールについて説明し、XS モジュールについては |
88 |
触れません。 |
89 |
XS モジュールは、通常とは若干異なる目的で利用されるため、配布する際には |
90 |
別の問題について考慮する必要があります。 |
91 |
つまり、糊付け(glue)の対象となるライブラリの人気、他の OS への |
92 |
ポータビリティなどです。 |
93 |
しかし、モジュールの準備やパッケージング、配布の説明は、XS モジュールにも |
94 |
同様に当てはまるでしょう。 |
95 |
|
96 |
=head2 What should I make into a module? |
97 |
|
98 |
(なにをモジュールにしたらいい?) |
99 |
|
100 |
=begin original |
101 |
|
102 |
You should make a module out of any code that you think is going to be |
103 |
useful to others. Anything that's likely to fill a hole in the communal |
104 |
library and which someone else can slot directly into their program. Any |
105 |
part of your code which you can isolate and extract and plug into |
106 |
something else is a likely candidate. |
107 |
|
108 |
=end original |
109 |
|
110 |
他の人に便利になるものなら、どんなコードでもモジュールにするべきです。 |
111 |
みんなが使っているライブラリに足りないものを補って、しかも他の人が自分の |
112 |
プログラムに直接組み込めるものならなんでも OK です。 |
113 |
あなたのコードのうち、単独でとりだして、他のものに組み込めるものがあれば、 |
114 |
それはモジュールの候補になりえるでしょう。 |
115 |
|
116 |
=begin original |
117 |
|
118 |
Let's take an example. Suppose you're reading in data from a local |
119 |
format into a hash-of-hashes in Perl, turning that into a tree, walking |
120 |
the tree and then piping each node to an Acme Transmogrifier Server. |
121 |
|
122 |
=end original |
123 |
|
124 |
例をとってみましょう。 |
125 |
ローカルのフォーマットからデータを読みだし、Perl のハッシュリファレンスの |
126 |
ハッシュにして、ツリー構造にして、ツリーを操作してそれぞれのノードを |
127 |
Acme Transmogrifier Server にパイプするとします。 |
128 |
|
129 |
=begin original |
130 |
|
131 |
Now, quite a few people have the Acme Transmogrifier, and you've had to |
132 |
write something to talk the protocol from scratch - you'd almost |
133 |
certainly want to make that into a module. The level at which you pitch |
134 |
it is up to you: you might want protocol-level modules analogous to |
135 |
L<Net::SMTP|Net::SMTP> which then talk to higher level modules analogous |
136 |
to L<Mail::Send|Mail::Send>. The choice is yours, but you do want to get |
137 |
a module out for that server protocol. |
138 |
|
139 |
=end original |
140 |
|
141 |
さて、Acme Transmogrifier をもっている人はあんまりいないとしましょう。 |
142 |
ですから、そのプロトコルを話すコードをスクラッチから |
143 |
書かなくてはならないでしょう - そんな時、それをモジュールにしたいはずです。 |
144 |
どのレベルで操作するかはあなた次第です: L<Net::SMTP> のような |
145 |
プロトコルレベルのモジュールから、L<Mail::Send> のような高レベルで |
146 |
操作するモジュールまで。 |
147 |
決定するのはあなたですが、サーバプロトコルに特化したモジュールを |
148 |
作りたいでしょう。 |
149 |
|
150 |
=begin original |
151 |
|
152 |
Nobody else on the planet is going to talk your local data format, so we |
153 |
can ignore that. But what about the thing in the middle? Building tree |
154 |
structures from Perl variables and then traversing them is a nice, |
155 |
general problem, and if nobody's already written a module that does |
156 |
that, you might want to modularise that code too. |
157 |
|
158 |
=end original |
159 |
|
160 |
あなたのローカルデータフォーマットに興味がある人はいないので、それは |
161 |
無視しましょう。 |
162 |
ただ、その中間データはどうしましょう? |
163 |
Perl 変数からツリー構造を作って、それをトラバースするのはよくあることで、 |
164 |
もしそういったモジュールを誰も書いてないのであれば、そのコードも |
165 |
またモジュール化したくなるでしょう。 |
166 |
|
167 |
=begin original |
168 |
|
169 |
So hopefully you've now got a few ideas about what's good to modularise. |
170 |
Let's now see how it's done. |
171 |
|
172 |
=end original |
173 |
|
174 |
さあ、どんなものをモジュール化すればいいのか、だんだんわかってきたでしょう。 |
175 |
これからそれをどうやってやるのか見てみましょう。 |
176 |
|
177 |
=head2 Step-by-step: Preparing the ground |
178 |
|
179 |
(Step-by-step: 地ならし) |
180 |
|
181 |
=begin original |
182 |
|
183 |
Before we even start scraping out the code, there are a few things we'll |
184 |
want to do in advance. |
185 |
|
186 |
=end original |
187 |
|
188 |
コードを書きはじめる前に、やっておきたいことがいくつかあります。 |
189 |
|
190 |
=over 3 |
191 |
|
192 |
=item Look around |
193 |
|
194 |
(見てまわる) |
195 |
|
196 |
=begin original |
197 |
|
198 |
Dig into a bunch of modules to see how they're written. I'd suggest |
199 |
starting with L<Text::Tabs|Text::Tabs>, since it's in the standard |
200 |
library and is nice and simple, and then looking at something a little |
201 |
more complex like L<File::Copy|File::Copy>. For object oriented |
202 |
code, C<WWW::Mechanize> or the C<Email::*> modules provide some good |
203 |
examples. |
204 |
|
205 |
=end original |
206 |
|
207 |
たくさんのモジュールを見て、どんな風に書かれているかみてみましょう。 |
208 |
L<Text::Tabs> は標準ライブラリで、きれいに書かれていてとても |
209 |
シンプルですので、これから始めると良いでしょう; それから |
210 |
L<File::Copy|File::Copy> のようなもう少し複雑なものを見てください。 |
211 |
オブジェクト指向のコードを書こうと思っているなら、 |
212 |
C<WWW::Mechanize> や C<Mail::*> モジュールがよい例となります。 |
213 |
|
214 |
=begin original |
215 |
|
216 |
These should give you an overall feel for how modules are laid out and |
217 |
written. |
218 |
|
219 |
=end original |
220 |
|
221 |
そうすれば、モジュールがどのようにレイアウトされ、書かれているか、大体 |
222 |
わかってくるはずです。 |
223 |
|
224 |
=item Check it's new |
225 |
|
226 |
(新しいものかどうかチェックする) |
227 |
|
228 |
=begin original |
229 |
|
230 |
There are a lot of modules on CPAN, and it's easy to miss one that's |
231 |
similar to what you're planning on contributing. Have a good plough |
232 |
through the L<http://search.cpan.org> and make sure you're not the one |
233 |
reinventing the wheel! |
234 |
|
235 |
=end original |
236 |
|
237 |
CPAN にはたくさんのモジュールがありますから、あなたが寄与しようとしている |
238 |
モジュールとそっくりなものがあっても、見過ごしてしまうかも知れません。 |
239 |
L<http://search.cpan.org> をよく見て、 |
240 |
車輪の再発明をしていないかどうか確認しましょう! |
241 |
|
242 |
=item Discuss the need |
243 |
|
244 |
(必要性を議論する) |
245 |
|
246 |
=begin original |
247 |
|
248 |
You might love it. You might feel that everyone else needs it. But there |
249 |
might not actually be any real demand for it out there. If you're unsure |
250 |
about the demand your module will have, consider sending out feelers |
251 |
on the C<comp.lang.perl.modules> newsgroup, or as a last resort, ask the |
252 |
modules list at C<modules@perl.org>. Remember that this is a closed list |
253 |
with a very long turn-around time - be prepared to wait a good while for |
254 |
a response from them. |
255 |
|
256 |
=end original |
257 |
|
258 |
あなたはそれを気に入っているでしょう。 |
259 |
他のみんなも、それを必要とすると思っているでしょう。 |
260 |
でも、実際にはそんなに需要はないかもしれません。 |
261 |
自分のモジュールがどの程度需要があるのか不安だったら、 |
262 |
C<comp.lang.perl.modules> に投稿してみましょう。 |
263 |
それでもだめなら、C<modules@perl.org> のモジュールメーリングリストに |
264 |
聞いてみましょう。 |
265 |
このメーリングリストはクローズドで、待ち時間が長いことに |
266 |
気を付けてください。 |
267 |
レスポンスが返ってくるまでには、しばらく待つ必要があるかもしれません。 |
268 |
|
269 |
=item Choose a name |
270 |
|
271 |
(名前を決める) |
272 |
|
273 |
=begin original |
274 |
|
275 |
Perl modules included on CPAN have a naming hierarchy you should try to |
276 |
fit in with. See L<perlmodlib> for more details on how this works, and |
277 |
browse around CPAN and the modules list to get a feel of it. At the very |
278 |
least, remember this: modules should be title capitalised, (This::Thing) |
279 |
fit in with a category, and explain their purpose succinctly. |
280 |
|
281 |
=end original |
282 |
|
283 |
CPAN に含まれる Perl モジュールには、命名階層があり、それに合わせる |
284 |
必要があります。 |
285 |
これがどのように整理されているかの詳細は、L<perlmodlib> を参照してください。 |
286 |
また、CPAN やモジュールリストを見て回って、どんなものか触れてみてください。 |
287 |
少なくとも、これだけは覚えておいてください: モジュール名は大文字で |
288 |
始める (This::That のように)、 カテゴリに適合している、そして、 |
289 |
目的を簡潔に説明している。 |
290 |
|
291 |
=item Check again |
292 |
|
293 |
(もう一度チェック) |
294 |
|
295 |
=begin original |
296 |
|
297 |
While you're doing that, make really sure you haven't missed a module |
298 |
similar to the one you're about to write. |
299 |
|
300 |
=end original |
301 |
|
302 |
そうしている間に、書こうとしているモジュールに似たモジュールを本当に |
303 |
見過ごしていないか、確認してください。 |
304 |
|
305 |
=begin original |
306 |
|
307 |
When you've got your name sorted out and you're sure that your module is |
308 |
wanted and not currently available, it's time to start coding. |
309 |
|
310 |
=end original |
311 |
|
312 |
整理が付いて、そのモジュールは必要とされていて、まだ存在しないと |
313 |
確信したら、コードを書きはじめましょう。 |
314 |
|
315 |
=back |
316 |
|
317 |
=head2 Step-by-step: Making the module |
318 |
|
319 |
(Step-by-step: モジュールを作る) |
320 |
|
321 |
=over 3 |
322 |
|
323 |
=item Start with F<module-starter> or F<h2xs> |
324 |
|
325 |
(F<module-starter> か F<h2xs> からはじめる) |
326 |
|
327 |
=begin original |
328 |
|
329 |
The F<module-starter> utility is distributed as part of the |
330 |
L<Module::Starter|Module::Starter> CPAN package. It creates a directory |
331 |
with stubs of all the necessary files to start a new module, according |
332 |
to recent "best practice" for module development, and is invoked from |
333 |
the command line, thus: |
334 |
|
335 |
=end original |
336 |
|
337 |
F<module-starter> ユーティリティは L<Module::Starter|Module::Starter> CPAN |
338 |
パッケージの一部として配布されています。 |
339 |
最近のモジュール開発の「ベストプラクティス」に基づいた、新しいモジュールを |
340 |
開始するために必要な全てのファイルの雛形を含むディレクトリを作ります; |
341 |
これはコマンドラインから起動されるので: |
342 |
|
343 |
module-starter --module=Foo::Bar \ |
344 |
--author="Your Name" --email=yourname@cpan.org |
345 |
|
346 |
=begin original |
347 |
|
348 |
If you do not wish to install the L<Module::Starter|Module::Starter> |
349 |
package from CPAN, F<h2xs> is an older tool, originally intended for the |
350 |
development of XS modules, which comes packaged with the Perl |
351 |
distribution. |
352 |
|
353 |
=end original |
354 |
|
355 |
L<Module::Starter|Module::Starter> パッケージを CPAN から |
356 |
インストールしたくない場合は、F<h2xs> はより古いツールで、本来は |
357 |
XS モジュールの開発のためのもので、Perl に同梱されています。 |
358 |
|
359 |
=begin original |
360 |
|
361 |
A typical invocation of L<h2xs|h2xs> for a pure Perl module is: |
362 |
|
363 |
=end original |
364 |
|
365 |
ピュア Perl のための L<h2xs|h2xs> の典型的な起動方法は: |
366 |
|
367 |
h2xs -AX --skip-exporter --use-new-tests -n Foo::Bar |
368 |
|
369 |
=begin original |
370 |
|
371 |
The C<-A> omits the Autoloader code, C<-X> omits XS elements, |
372 |
C<--skip-exporter> omits the Exporter code, C<--use-new-tests> sets up a |
373 |
modern testing environment, and C<-n> specifies the name of the module. |
374 |
|
375 |
=end original |
376 |
|
377 |
C<-A> は Autoloader を省略し、C<-X> は XS を省略し、 |
378 |
C<--skip-exporter> は Exporter コードを省略し、C<--use-new-tests> は |
379 |
近代的なテスト環境を設定し、C<-n> はモジュールの名前を指定します。 |
380 |
|
381 |
=item Use L<strict|strict> and L<warnings|warnings> |
382 |
|
383 |
(L<strict|strict> と L<warnings|warnings> を使う) |
384 |
|
385 |
=begin original |
386 |
|
387 |
A module's code has to be warning and strict-clean, since you can't |
388 |
guarantee the conditions that it'll be used under. Besides, you wouldn't |
389 |
want to distribute code that wasn't warning or strict-clean anyway, |
390 |
right? |
391 |
|
392 |
=end original |
393 |
|
394 |
モジュールのコードは warning と strict クリーンでなくてはなりません。 |
395 |
どんな状況でそのモジュールが利用されるかわかりませんから。 |
396 |
それに、warning や strict クリーンでないコードなんて、 |
397 |
配布したくないでしょう? |
398 |
|
399 |
=item Use L<Carp|Carp> |
400 |
|
401 |
(L<Carp|Carp> を使う) |
402 |
|
403 |
=begin original |
404 |
|
405 |
The L<Carp|Carp> module allows you to present your error messages from |
406 |
the caller's perspective; this gives you a way to signal a problem with |
407 |
the caller and not your module. For instance, if you say this: |
408 |
|
409 |
=end original |
410 |
|
411 |
L<Carp> モジュールを使うと、エラーメッセージを呼び出し側の視点から |
412 |
出力することが出来ます。 |
413 |
そのモジュールではなく、呼び出し側の問題であることを示せるのです。 |
414 |
例えば、このようにすると: |
415 |
|
416 |
warn "No hostname given"; |
417 |
|
418 |
=begin original |
419 |
|
420 |
the user will see something like this: |
421 |
|
422 |
=end original |
423 |
|
424 |
ユーザはこのようなメッセージを見ることになります: |
425 |
|
426 |
No hostname given at /usr/local/lib/perl5/site_perl/5.6.0/Net/Acme.pm |
427 |
line 123. |
428 |
|
429 |
=begin original |
430 |
|
431 |
which looks like your module is doing something wrong. Instead, you want |
432 |
to put the blame on the user, and say this: |
433 |
|
434 |
=end original |
435 |
|
436 |
これでは、あなたのモジュールが何か間違ったことをしているように見えます。 |
437 |
代わりに、ユーザに責任をなすりつけられるのです。 |
438 |
このように出力します: |
439 |
|
440 |
No hostname given at bad_code, line 10. |
441 |
|
442 |
=begin original |
443 |
|
444 |
You do this by using L<Carp|Carp> and replacing your C<warn>s with |
445 |
C<carp>s. If you need to C<die>, say C<croak> instead. However, keep |
446 |
C<warn> and C<die> in place for your sanity checks - where it really is |
447 |
your module at fault. |
448 |
|
449 |
=end original |
450 |
|
451 |
こうするには、L<Carp> をつかって、C<warn> を C<carp> に置き換えます。 |
452 |
もし C<die> する必要があるなら、C<croak> を使いましょう。 |
453 |
ただ、本当にあなたのモジュールの責任によるチェックの場合は、 |
454 |
C<warn> や C<die> のままにしておきましょう。 |
455 |
|
456 |
=item Use L<Exporter|Exporter> - wisely! |
457 |
|
458 |
(L<Exporter|Exporter> を使う - 賢く!) |
459 |
|
460 |
=begin original |
461 |
|
462 |
L<Exporter|Exporter> gives you a standard way of exporting symbols and |
463 |
subroutines from your module into the caller's namespace. For instance, |
464 |
saying C<use Net::Acme qw(&frob)> would import the C<frob> subroutine. |
465 |
|
466 |
=end original |
467 |
|
468 |
L<Exporter|Exporter> は、シンボルやサブルーチンをモジュールから |
469 |
呼び出し側の名前空間にエクスポートする標準的な方法がわかるでしょう。 |
470 |
たとえば、C<use Net::Acme qw(&frob)> と書けば、C<frob> サブルーチンを |
471 |
インポートします。 |
472 |
|
473 |
=begin original |
474 |
|
475 |
The package variable C<@EXPORT> will determine which symbols will get |
476 |
exported when the caller simply says C<use Net::Acme> - you will hardly |
477 |
ever want to put anything in there. C<@EXPORT_OK>, on the other hand, |
478 |
specifies which symbols you're willing to export. If you do want to |
479 |
export a bunch of symbols, use the C<%EXPORT_TAGS> and define a standard |
480 |
export set - look at L<Exporter> for more details. |
481 |
|
482 |
=end original |
483 |
|
484 |
パッケージ変数の C<@EXPORT> によって、呼び出し側が単純に |
485 |
C<use Net::Acme> と書いたときに、どのシンボルがエクスポートされるかが |
486 |
決まります。 |
487 |
ほとんどの場合は、ここには何もいれないでしょう。 |
488 |
一方、C<@EXPORT_OK> をつかうと、どの変数をエクスポートしてもよいかを |
489 |
指定できます。 |
490 |
たくさんのシンボルをエクスポートしたい場合は、C<%EXPORT_TAGS> を |
491 |
使って、エクスポートのセットを定義しましょう。 |
492 |
詳しくは L<Exporter> を参照してください。 |
493 |
|
494 |
=item Use L<plain old documentation|perlpod> |
495 |
|
496 |
(L<plain old documentation|perlpod> を使う) |
497 |
|
498 |
=begin original |
499 |
|
500 |
The work isn't over until the paperwork is done, and you're going to |
501 |
need to put in some time writing some documentation for your module. |
502 |
C<module-starter> or C<h2xs> will provide a stub for you to fill in; if |
503 |
you're not sure about the format, look at L<perlpod> for an |
504 |
introduction. Provide a good synopsis of how your module is used in |
505 |
code, a description, and then notes on the syntax and function of the |
506 |
individual subroutines or methods. Use Perl comments for developer notes |
507 |
and POD for end-user notes. |
508 |
|
509 |
=end original |
510 |
|
511 |
仕事はペーパーワークがすむまでは、終わりではありません。 |
512 |
モジュールのドキュメントを書くための時間が必要です。 |
513 |
C<module-starter> か C<h2xs> を利用すれば、テンプレートを作ってくれますので、 |
514 |
それを埋めればよいです; |
515 |
フォーマットがよくわからなければ、まずは L<perlpod> を見てください。 |
516 |
モジュールをどのように使うかのおおまかな概要、そして文法の説明や、 |
517 |
それぞれのサブルーチンやメソッドの機能説明を提供してください。 |
518 |
開発者のノートとして Perl のコメントを利用し、エンドユーザへの |
519 |
ノートには POD を使ってください。 |
520 |
|
521 |
=item Write tests |
522 |
|
523 |
(テストを書く) |
524 |
|
525 |
=begin original |
526 |
|
527 |
You're encouraged to create self-tests for your module to ensure it's |
528 |
working as intended on the myriad platforms Perl supports; if you upload |
529 |
your module to CPAN, a host of testers will build your module and send |
530 |
you the results of the tests. Again, C<module-starter> and C<h2xs> |
531 |
provide a test framework which you can extend - you should do something |
532 |
more than just checking your module will compile. |
533 |
L<Test::Simple|Test::Simple> and L<Test::More|Test::More> are good |
534 |
places to start when writing a test suite. |
535 |
|
536 |
=end original |
537 |
|
538 |
ぜひユニットテストコードを作って、あなたのモジュールが、いろんな |
539 |
プラットフォーム上の Perl で、意図した通りにうまく動くことを確認しましょう。 |
540 |
CPAN にモジュールをアップロードすると、たくさんのテスターがモジュールを |
541 |
ビルドして、テストの結果をあなたに送ってくれるでしょう。 |
542 |
ここでもまた、C<module-starter> と C<h2xs> を使えば、後で拡張可能な、 |
543 |
テストフレームワークが提供されます。 |
544 |
単にコンパイルが通るかだけでなく、いろいろとテストしましょう。 |
545 |
L<Test::Simple|Test::Simple> と L<Test::More|Test::More> は、テスト |
546 |
スイートを書くときの開始点としてよいものです。 |
547 |
|
548 |
=item Write the README |
549 |
|
550 |
(README を書く) |
551 |
|
552 |
=begin original |
553 |
|
554 |
If you're uploading to CPAN, the automated gremlins will extract the |
555 |
README file and place that in your CPAN directory. It'll also appear in |
556 |
the main F<by-module> and F<by-category> directories if you make it onto |
557 |
the modules list. It's a good idea to put here what the module actually |
558 |
does in detail, and the user-visible changes since the last release. |
559 |
|
560 |
=end original |
561 |
|
562 |
CPAN にアップロードするときは、README ファイルが自動で抽出されて、 |
563 |
あなたの CPAN ディレクトリに置かれます。 |
564 |
また、モジュールリストに載った場合には、F<by-module> や F<by-category> の |
565 |
メインディレクトリにも配置されます。 |
566 |
このファイルに、そのモジュールのすることの詳細や、一つ前のリリースからの |
567 |
変更点を書いておくと良いでしょう。 |
568 |
|
569 |
=back |
570 |
|
571 |
=head2 Step-by-step: Distributing your module |
572 |
|
573 |
(Step-by-step: モジュールを配布する) |
574 |
|
575 |
=over 3 |
576 |
|
577 |
=item Get a CPAN user ID |
578 |
|
579 |
(CPAN ユーザ ID を取得する) |
580 |
|
581 |
=begin original |
582 |
|
583 |
Every developer publishing modules on CPAN needs a CPAN ID. Visit |
584 |
C<http://pause.perl.org/>, select "Request PAUSE Account", and wait for |
585 |
your request to be approved by the PAUSE administrators. |
586 |
|
587 |
=end original |
588 |
|
589 |
CPAN でモジュールを配布するには、CPAN ID が必要です。 |
590 |
C<http://pause.perl.org/> に訪れて、"Request PAUSE Account" を選択し、 |
591 |
リクエストが PAUSE 管理者に承認されるのを待ちましょう。 |
592 |
|
593 |
=item C<perl Makefile.PL; make test; make dist> |
594 |
|
595 |
=begin original |
596 |
|
597 |
Once again, C<module-starter> or C<h2xs> has done all the work for you. |
598 |
They produce the standard C<Makefile.PL> you see when you download and |
599 |
install modules, and this produces a Makefile with a C<dist> target. |
600 |
|
601 |
=end original |
602 |
|
603 |
ここでも、C<module-starter> や C<h2xs> はすべてやってくれます。 |
604 |
モジュールをインストールするときによく見る、標準的な C<Makefile.PL> が |
605 |
できています。 |
606 |
これが生成する Makefile に C<dist> ターゲットがあります。 |
607 |
|
608 |
=begin original |
609 |
|
610 |
Once you've ensured that your module passes its own tests - always a |
611 |
good thing to make sure - you can C<make dist>, and the Makefile will |
612 |
hopefully produce you a nice tarball of your module, ready for upload. |
613 |
|
614 |
=end original |
615 |
|
616 |
モジュールがテストにパスしたことを確認したら(いつでも確認することは |
617 |
よいことです)、C<make dist> を実行すれば、Makefile はアップロード準備の |
618 |
整った tarball ファイルを生成してくれます。 |
619 |
|
620 |
=item Upload the tarball |
621 |
|
622 |
(tarball をアップロードする) |
623 |
|
624 |
=begin original |
625 |
|
626 |
The email you got when you received your CPAN ID will tell you how to |
627 |
log in to PAUSE, the Perl Authors Upload SErver. From the menus there, |
628 |
you can upload your module to CPAN. |
629 |
|
630 |
=end original |
631 |
|
632 |
CPAN ID を取得できたときに届く email に、PAUSE (the Perl Authors |
633 |
Upload SErver) へのログイン方法が載っています。 |
634 |
メニューから選択して、モジュールをCPANにアップロードできます。 |
635 |
|
636 |
=item Announce to the modules list |
637 |
|
638 |
(モジュールリストにアナウンスする) |
639 |
|
640 |
=begin original |
641 |
|
642 |
Once uploaded, it'll sit unnoticed in your author directory. If you want |
643 |
it connected to the rest of the CPAN, you'll need to go to "Register |
644 |
Namespace" on PAUSE. Once registered, your module will appear in the |
645 |
by-module and by-category listings on CPAN. |
646 |
|
647 |
=end original |
648 |
|
649 |
アップロードしたら、あなたのディレクトリにあるだけでは人目を引きません。 |
650 |
他のの CPAN モジュールと同じように載せたければ、PAUSE の |
651 |
"Register Namespace" に行く必要があります。 |
652 |
登録されると、あなたのモジュールは CPAN のモジュール別およびカテゴリ別の |
653 |
リストに表示されます。 |
654 |
|
655 |
=item Announce to clpa |
656 |
|
657 |
(clpa にアナウンスする) |
658 |
|
659 |
=begin original |
660 |
|
661 |
If you have a burning desire to tell the world about your release, post |
662 |
an announcement to the moderated C<comp.lang.perl.announce> newsgroup. |
663 |
|
664 |
=end original |
665 |
|
666 |
リリースしたことを世界中にアナウンスしたいという野望があるなら、 |
667 |
モデレートされている、C<comp.lang.perl.announce> ニュースグループに |
668 |
アナウンスを投稿してみましょう。 |
669 |
|
670 |
=item Fix bugs! |
671 |
|
672 |
(バグをなおす!) |
673 |
|
674 |
=begin original |
675 |
|
676 |
Once you start accumulating users, they'll send you bug reports. If |
677 |
you're lucky, they'll even send you patches. Welcome to the joys of |
678 |
maintaining a software project... |
679 |
|
680 |
=end original |
681 |
|
682 |
ユーザが集まってくると、バグレポートが送られて来ます。 |
683 |
運がよければ、パッチを送ってくれるでしょう。 |
684 |
ソフトウェアプロジェクトのメンテナンスという喜びが待っています ... |
685 |
|
686 |
=back |
687 |
|
688 |
=head1 AUTHOR |
689 |
|
690 |
Simon Cozens, C<simon@cpan.org> |
691 |
|
692 |
Updated by Kirrily "Skud" Robert, C<skud@cpan.org> |
693 |
|
694 |
=head1 SEE ALSO |
695 |
|
696 |
=begin original |
697 |
|
698 |
L<perlmod>, L<perlmodlib>, L<perlmodinstall>, L<h2xs>, L<strict>, |
699 |
L<Carp>, L<Exporter>, L<perlpod>, L<Test::Simple>, L<Test::More> |
700 |
L<ExtUtils::MakeMaker>, L<Module::Build>, L<Module::Starter> |
701 |
http://www.cpan.org/ , Ken Williams's tutorial on building your own |
702 |
module at http://mathforum.org/~ken/perl_modules.html |
703 |
|
704 |
=end original |
705 |
|
706 |
L<perlmod>, L<perlmodlib>, L<perlmodinstall>, L<h2xs>, L<strict>, |
707 |
L<Carp>, L<Exporter>, L<perlpod>, L<Test::Simple>, L<Test::More> |
708 |
L<ExtUtils::MakeMaker>, L<Module::Build>, L<Module::Starter> |
709 |
http://www.cpan.org/ , http://mathforum.org/~ken/perl_modules.html にある、 |
710 |
Ken Williams による自作のモジュールをビルドするためのチュートリアル。 |
711 |
|
712 |
=begin meta |
713 |
|
714 |
Translate: miyagawa |
715 |
Update: SHIRAKATA Kentaro <argrath@ub32.org> (5.10.0-) |
716 |
Status: completed |
717 |
|
718 |
=end meta |
719 |
|