in reply to Re^4: Fields pragma - the poor man's OO framework?
in thread Fields pragma - the poor man's OO framework?

You cannot check all hash accesses at compile time. Therefore, fields must do many things at runtime. Therefore, it must have a runtime component. I suggested using tie. lock_keys() is a perfectly good other solution. tie has the added benefit of being able to do other things than just restricting keynames. YMMV.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re^5: Fields pragma - the poor man's OO framework?

Replies are listed 'Best First'.
Re^6: Fields pragma - the poor man's OO framework?
by waba (Monk) on Jul 08, 2008 at 18:54 UTC

    As far as I can tell, 'fields' performs checks both at compile time (most common case, if used carefully) and at run-time (thanks to Hash::Util, as explained by Arunbear).

    I just noticed an issue (bug?) in the 5.10 implementation. I'll post it in a top-level subthread, so that any wandering Googler gets a chance to see it.