Open leonerd opened 4 years ago
I think the thrust of my question is, basically, why don't all unblessed references already act as if they were actually objects in classes called ARRAY
, HASH
, etc..., whose packages were already prepopulated with methods that behave "as expected"?
With the addition of
IO::Handle
in some automatic magic around 5.12 (I forget the exact history), you can now just do things likeand even if
$fh
is just a regular filehandle calling an IO method on it like that works just fine. But if it happens to be a fancy object with a real method, then that works too. It's great, I use this all the time whenever my modules expect an IO-like value to be passed in. Users can give me a real IO handle in real code, or a totally virtual thing maybe in a unit test or whatever, and all works out fine.Why can't we do this for arrays and hashes too?
Specifically,
We can sortof fake this up with
but it'd be great if that happened automatically.