Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I'm biased - I wrote UNIVERSAL::ref. I think you should be writing $thing->is_array instead of ref($thing)->is_array or Scalar::Util::reftype($thing)->is_array. That is, the thing itself should be responsible for telling you about itself and not some external bit of code.

    I trend toward the Smalltalk end of the idea spectrum and I'd prefer that $thing be able to respond for itself. Outsourcing introspection prevents $thing from being able to intelligently decide to answer the question *differently* sometimes.

    Also, when you're writing your ->is_array code, are you accounting for things that aren't arrays but act like them because of overloading?

    package ...;
    use overload '@{}' => 'act_like_an_array';