1
我寫我自己的模塊,在我所定義的三個功能:方法::簽名,功能輸出的順序模塊
package YUCO::Test;
use 5.008008;
use strict;
use warnings;
require Exporter;
use AutoLoader qw(AUTOLOAD);
use Method::Signatures;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ('all' => [ qw() ]);
our @EXPORT_OK = (@{ $EXPORT_TAGS{'all'} });
our @EXPORT = qw(Test1 Test2 Test3);
our $VERSION = '0.01';
#-----------------------------------------------------
func Test1(Str $a='')
{
print ' ok from Test1, and a is : '.$a."\n";
}
#-----------------------------------------------------
func Test2(Str $a='')
{
print ' ok from Test2, and a is : '.$a."\n";
}
#-----------------------------------------------------
func Test3(Str $a='')
{
print ' ok from Test3, and a is : '.$a."\n";
}
#-----------------------------------------------------
1;
__END__
,然後當我做了一個測試程序與這些行:
#!/usr/bin/perl -w
use strict;
use warnings;
use YUCO::Test qw(Test1 Test2 Test3);
Test1('a ar');
Test2('b lo');
Test3('..c..');
Test1();
Test2();
Test3();
它具有這樣的輸出,它具有一些奇怪/隨機輸出序列:
ok from Test2, and a is : b lo ok from Test3, and a is : ..c.. ok from Test2, and a is : ok from Test3, and a is : ok from Test1, and a is : a ar ok from Test1, and a is :
但它們並不完全隨機,因爲每次運行腳本時它都會有這樣的確切序列。