2012-01-20 2 views
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__ 

하고는 나는이 라인 테스트 프로그램을 수행 할 때

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 : 
:
#!/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(); 

그것은 이상한/출력 랜덤 서열을 갖는 다음과 같은 결과를 갖는다

하지만 스크립트가 실행될 때마다 이와 같은 정확한 시퀀스를 갖게된다는 점에서 이들은 정확하지 않습니다. 당신은 코드 mangler 다음을 수행하여 달링를 엉망으로하는 방법을 확인 할 수 있습니다

답변

2

:

use Data::Dumper qw<Dumper>; 

$Data::Dumper::Deparse = 1; 

say Dumper(\&YUCO::Test::Test1); 

은 아마도 그것이 당신에게 단서를 얻을 수 있습니다.