If nothing else, if you follow the comments, and the logic (if you call it that) it will illustrate a whole bunch of links and perl ideas from passing hashes/references to anonymous hashes and subroutines. All sorts of perl "tricks" done in a STRAIGHT FORWARD way.
A really good programmer could take the tricks and do other stuff with them, but I go by the maxim that a "Shortcut is something that saves your time, and wastes everyone elses."
One thing I _do_ know needs done, is the call to &main is a real kludge. It should be broken up into a call to &main then a call to one or 2 other processes, since too much is being done in the "main" that really should only be a create the cgi-object, get the ID record, and then branch by "if posted" or "if not posted" Any one who wants to clean that up, it's sort of obvious.
If you are overly concerned about performance, you need to use optimization tags (to strip the comments and slower code out) or parallel development.
The reason is that when "speed" is a selling feature, you want to design for it, but you need to have code that can be maintained. Often the "tricks" are so obscure they are missed, or may not work in the next release of the compiler. At the very least they slow down the interpretation of the code by those who follow.
I just don't think this script is one where speed counts first of all -- it's by nature a pig of a script. The sendmail or smpt interface is probably the slowest part of this whole thing (maybe the template processing) and any code bloat should be trivial -- or less than trivial -- in comparason.
I'm open to any comments on this, and when people see the code, the terms of the license are to SHARE ANY MODS OR CHANGES or you are in violation of it (sort of a very short GPL license <G> ).
This code is _much_ better than the version I made during the first month, but it's a learning/example code and is definitely NOT pretty. But, there should only be one or two edits in the code file that are needed, and everything else should be done in the templates, which is a good thing --- right? <G> (I might even be able to get that reduced to nothing by the time I release it, since I think the only variables that need to be set are available in Links.pm.) That would make this really plug-n-play and you'd only have to fiddle with your templates.
Oh -- and the one change to count referrals if you want it. There's no way to make that plug-n-play since it needs a database field to be created.
[This message has been edited by pugdog (edited April 12, 2000).]
A really good programmer could take the tricks and do other stuff with them, but I go by the maxim that a "Shortcut is something that saves your time, and wastes everyone elses."
One thing I _do_ know needs done, is the call to &main is a real kludge. It should be broken up into a call to &main then a call to one or 2 other processes, since too much is being done in the "main" that really should only be a create the cgi-object, get the ID record, and then branch by "if posted" or "if not posted" Any one who wants to clean that up, it's sort of obvious.
If you are overly concerned about performance, you need to use optimization tags (to strip the comments and slower code out) or parallel development.
The reason is that when "speed" is a selling feature, you want to design for it, but you need to have code that can be maintained. Often the "tricks" are so obscure they are missed, or may not work in the next release of the compiler. At the very least they slow down the interpretation of the code by those who follow.
I just don't think this script is one where speed counts first of all -- it's by nature a pig of a script. The sendmail or smpt interface is probably the slowest part of this whole thing (maybe the template processing) and any code bloat should be trivial -- or less than trivial -- in comparason.
I'm open to any comments on this, and when people see the code, the terms of the license are to SHARE ANY MODS OR CHANGES or you are in violation of it (sort of a very short GPL license <G> ).
This code is _much_ better than the version I made during the first month, but it's a learning/example code and is definitely NOT pretty. But, there should only be one or two edits in the code file that are needed, and everything else should be done in the templates, which is a good thing --- right? <G> (I might even be able to get that reduced to nothing by the time I release it, since I think the only variables that need to be set are available in Links.pm.) That would make this really plug-n-play and you'd only have to fiddle with your templates.
Oh -- and the one change to count referrals if you want it. There's no way to make that plug-n-play since it needs a database field to be created.
[This message has been edited by pugdog (edited April 12, 2000).]