Greetings smart people
A CGI form processing script I am happily working on every day is now becming
harder to read [maintain] and bloated. Mainly because I have been adding sets of
nested 'either statements as I check, debubug and grow my all error trapping
logic.
Time to factor out and simplify the mess. Need strategic advice.. or examples of
rebol idioms for idioms to keep manage logic, keep clutter in check, avoid
nested 'either [using 'find perhaps
functions, objects..]
Sorry my request is so vague.. I am hungry to read someone else's nice REBOL
code and hear voices of experience in this.
My webform page has about 6 entry fields and a number of check boxes to enable
some options.
In time it needs to grow. Making sure the basic script runs smoothly now means
looking the form variables passed into my cgi-obj and being kind but efficient.
Here's the kind of clumsy trash I have lots of and want to clean up.
;====================================
; TEST FOR PASSWORD
;====================================
upass: copy ""
loginstatus: false
either error? try [
;condition
upass: cgi-obj/userpass
][
;error
if = upass "" [
print rejoin [
{<b>Bad login!</b>}
{no user password provided }
{<a href="upload.html">}{try again}{</a>}
{<br>}
]
]
quit
if <> upass "" [
print rejoin [
{funny password provided. Please }
{<a href="upload.html">}{try again}{</a>}
{<br>}
]
]
][
; ok user has submitted a name and password
; check to see if they match
upass: cgi-obj/userpass
either = upass logindict/:uname
[loginstatus: true]
[loginstatus: false]
if not loginstatus [
;trouble in paradise - help them out..
print rejoin [
{<br>Username and password do not match. <br>Please }
{<a href="upload.html">}{try again}{</a>}
{<form method="POST" action="echo-login.r" enctype="multipart/form-data">
<i>Forgot your login or need to register ? <br>
Please enter your email address here: </i>
<input type="text" name="email_address" value=""/>
<input type="submit" value="send login by email"/>
</form>}
]
quit
]
]
thanks any advice
./Jason
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.