Restricting a Method to Class-Only o Instance-Only
use Carp qw(croak);
sub instance_only {
ref(my $self = shift ) or croak "instance variable needed";
... use $self as the instance ...
}
sub class_only {
ref(my $self = shift) and croak "class name needed";
... use $class as the class..
}
instance variable needed at their_code line 1234
告訴使用者引起問題的行號
croak->die
crap->warn
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24104518/viewspace-722725/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Restricting Access to a Database at StartupRESTDatabase
- Numerical Results of RhDYas CG method and RhLHas CG method
- Go語言之methodGo
- JAVA Method的解析Java
- post 405 method not allowed
- chinese input method in emacsMac
- The method of create a replicate of the database .Database
- o(* ̄- ̄*)o
- IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokensExceptionHTTP
- java程式碼中init method和destroy method的三種使用方式Java
- [vue] computed 和 methodVue
- method.invoke(...)反射點反射
- what is the Mixin method in Python?Python
- The House of Mind (FASTBIN METHOD) PRIMEAST
- form&method【POST~GET】ORM
- Python中的methodPython
- o2o系統 本地生活服務 微信o2o
- 演算法中的O(1), O(n),O(logn), O(nlogn)演算法
- Python: 函式與方法的區別 以及 Bound Method 和 Unbound MethodPython函式
- 時間複雜度O(1)、O(n)、O(n²)、O(nlogn)的含義時間複雜度
- java 8裡 Method方法bugJava
- ios method swizzlingiOS
- 設計模式-Template Method Pattern設計模式
- 佳弗O2O系統
- Veritas Quick I/O and Cached Quick I/OUI
- methodHandle* method, JavaCallArguments* args, TRAPSJava
- Method ReflectionParameter::getClass() 解決方法
- function和bound method的區別Function
- 反射--Class物件功能--獲取Method反射物件
- interface method 返回 interface 如何實現?
- Unsupported method: AndroidProject.getPluginGeneration()AndroidProjectPlugin
- java 反射之操作靜態MethodJava反射
- method=post/get區別記錄
- [CareerCup] 16.6 Synchronized Method 同步方法synchronized
- Uncaught TypeError: Object # has no method 'load'ErrorObject
- Python 魔術方法 - Magic MethodPython
- ubuntu emacs not use fcitx input methodUbuntuMac
- Spring - lookup-method使用示例Spring