Slash Boxes
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

use Perl Log In

Log In

[ Create a new account ]

Mark Leighton Fisher (4252)

Mark Leighton Fisher
  (email not shown publicly)

I am a Systems Engineer at Regenstrief Institute []. I also own Fisher's Creek Consulting [].
Friday June 16, 2006
12:10 PM

Design by Contract: Not with lvalue subs

[ #29928 ]

I'd thought that I would write about using Design by Contract preconditions and postconditions with Perl and VB. I had not used Perl lvalue subs before, but I thought it would be easy to use an lvalue sub to perform data validation as preconditions and postconditions. After much experimentation, then some Googling, I finally found a post about lvalue subs on Perl Monks explaining that you can't actually do anything with the value while you are in the lvalue sub:

  1. You can't examine the proposed new value before the assignment; and
  2. You can't check the value after assigning it.

Thus endeth the lesson for the day.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.