- バックアップ一覧
- バックアップ を表示
- Perl/Exporter は削除されています。
- 1 (2006-05-22 (月) 22:04:48)
* Exporterモジュール [#v4903d5a]
サブルーチンをインポート可能にする。
MyModule.pm
#!/usr/bin/perl
package MyModule;
use Exporter;
@ISA = (Exporter);
@EXPORT = qw(sub1 sub2);
sub sub1 {
print "this is sub1\n";
}
sub sub2 {
print "this is sub2\n";
}
1;
1.pl
#!/usr/bin/perl
use MyModule;
sub1();
sub2();
> ./1.pl
this is sub1
this is sub2
**参考 [#d1668110]
- http://www.rfs.jp/sb/perl/04/01.html
- http://search.cpan.org/~nwclark/perl-5.8.8/lib/Exporter.pm