On 2013-11-13 08:28, Aldo Calpini wrote:
This is what I turned in for the justification.
more Types.txt
ease of use;
With a few exceptions, the functions exported are the names of the basic
types. They either take a parameter or not.
If there is a parameter, it tests it as a ref to see if it points to an
object of the type (blessed or not blessed). On true, returns the
object, undef otherwise.
If the typename occurs w/no params, it returns itself as a literal --
allowing use of the type names w/o quotes.
Ex:
sub whatever(my argp) { die P "Args must be passed as %s", HASH unless
HASH $argp; ...}
Also useful funcs:
"EhV $hash, key ===
exists hash->{key} ? hash->{$key}:undef;
(I found myself wanting the value but needing to test if
it existed first so as not to autovivify).
'typ' $ref -- returns base type of $ref (vs. 'ref'
returns package or classname). Chose 'typ' as I thought
it less likely to conflict with anything that if I used
'type' -- and its 3 letters like 'ref'.
There were a few other util functions included that I will likely leave
in but in a Exports_ok type list -- and likely won't document at first,
because I thought they were useful when I wrote them -- but haven't used
them. All of them have to do with type/ref checking shorthands some
returning T/F, some dying...
It's expected to remain fairly basic. Optionally uses Scalar::Utils if
present, else it uses the original code as fallback code.
It's not meant to be fancy -- just simple and convenient.