=encoding euc-jp =head1 NAME =begin original Test::Builder::Module - Base class for test modules =end original Test::Builder::Module - テストモジュールのための基底クラス =head1 SYNOPSIS # Emulates Test::Simple package Your::Module; my $CLASS = __PACKAGE__; use base 'Test::Builder::Module'; @EXPORT = qw(ok); sub ok ($;$) { my $tb = $CLASS->builder; return $tb->ok(@_); } 1; =head1 DESCRIPTION =begin original This is a superclass for Test::Builder-based modules. It provides a handful of common functionality and a method of getting at the underlying Test::Builder object. =end original これは Test::Builder ベースのモジュールのスーパークラスです。 基となる Test::Builder オブジェクトを使う、便利な共通機能とメソッドを 提供します。 =head2 Importing (インポート) =begin original Test::Builder::Module is a subclass of Exporter which means your module is also a subclass of Exporter. @EXPORT, @EXPORT_OK, etc... all act normally. =end original Test::Builder::Module は Exporter のサブクラスなので、あなたのモジュールも Exporter のサブクラスになります。 @EXPORT, @EXPORT_OK などは通常通り動作します。 =begin original A few methods are provided to do the C 23> part for you. =end original C 23> 部分を行うためのいくつかのメソッドが 提供されています。 =head3 import =begin original Test::Builder::Module provides an import() method which acts in the same basic way as Test::More's, setting the plan and controlling exporting of functions and variables. This allows your module to set the plan independent of Test::More. =end original Test::Builder::Module provides an import() method which acts in the same basic way as Test::More's, setting the plan and controlling exporting of functions and variables. This allows your module to set the plan independent of Test::More. (TBT) =begin original All arguments passed to import() are passed onto C<< Your::Module->builder->plan() >> with the exception of C<< import =>[qw(things to import)] >>. =end original All arguments passed to import() are passed onto C<< Your::Module->builder->plan() >> with the exception of C<< import =>[qw(things to import)] >>. (TBT) use Your::Module import => [qw(this that)], tests => 23; =begin original says to import the functions this() and that() as well as set the plan to be 23 tests. =end original says to import the functions this() and that() as well as set the plan to be 23 tests. (TBT) =begin original import() also sets the exported_to() attribute of your builder to be the caller of the import() function. =end original import() also sets the exported_to() attribute of your builder to be the caller of the import() function. (TBT) =begin original Additional behaviors can be added to your import() method by overriding import_extra(). =end original Additional behaviors can be added to your import() method by overriding import_extra(). (TBT) =cut =head3 import_extra Your::Module->import_extra(\@import_args); =begin original import_extra() is called by import(). It provides an opportunity for you to add behaviors to your module based on its import list. =end original import_extra() is called by import(). It provides an opportunity for you to add behaviors to your module based on its import list. (TBT) =begin original Any extra arguments which shouldn't be passed on to plan() should be stripped off by this method. =end original Any extra arguments which shouldn't be passed on to plan() should be stripped off by this method. (TBT) =begin original See Test::More for an example of its use. =end original See Test::More for an example of its use. (TBT) =begin original B This mechanism is I as it feels like a bit of an ugly hack in its current form. =end original B This mechanism is I as it feels like a bit of an ugly hack in its current form. (TBT) =cut =head2 Builder (ビルダー) =begin original Test::Builder::Module provides some methods of getting at the underlying Test::Builder object. =end original Test::Builder::Module は、基となる Test::Builder オブジェクトを得るための メソッドを提供します。 =head3 builder my $builder = Your::Class->builder; =begin original This method returns the Test::Builder object associated with Your::Class. It is not a constructor so you can call it as often as you like. =end original This method returns the Test::Builder object associated with Your::Class. It is not a constructor so you can call it as often as you like. (TBT) =begin original This is the preferred way to get the Test::Builder object. You should I get it via C<< Test::Builder->new >> as was previously recommended. =end original This is the preferred way to get the Test::Builder object. You should I get it via C<< Test::Builder->new >> as was previously recommended. (TBT) =begin original The object returned by builder() may change at runtime so you should call builder() inside each function rather than store it in a global. =end original The object returned by builder() may change at runtime so you should call builder() inside each function rather than store it in a global. (TBT) sub ok { my $builder = Your::Class->builder; return $builder->ok(@_); } =begin meta Translate: SHIRAKATA Kentaro Status: in progress =end meta =cut