2013-08-01 25 views

回答

1

你有tried it?

package Foo { 
    sub bar { 
     warnings::warnif(deprecated => 'Foo:bar is deprecated'); 
    } 
} 

use warnings; 
# no warnings 'deprecated'; # <-- uncomment this to disable the warning 
Foo::bar();     # <-- this is line 9 

這應該這樣說:

Foo::bar is deprecated at test.pl line 9. 

其實,看着warnings.pm source,似乎在內部使用Carp.pm。誠然,對於警告編譯器的文檔可能是這個清晰,但perllexwarn不讓它非常清楚,這是它的意思是如何被使用。

+0

是的,我試了一下..在MOP顯然即使是現在,我已經設置'擺脫我所有的行號... @ CARP_NOT'適當,所以我不知道它是做正確的事(或原「@ CARP_NOT」會被服從)。現在,我想我需要弄清楚什麼我失蹤,因爲我把'__PACKAGE__'在'@ CARP_NOT'但它仍然似乎是從包裝,而不是測試文件吹毛求疵。 – xenoterracide

+0

[後續問題](http://stackoverflow.com/q/18004716/206466) – xenoterracide