>> This begs the question if this isn't problematic then. I can forsee
>> someone
>> commenting out a line(s) in a file without realizing that there is no
>> useful
>> body left, and finding themselves with errors/problems because of empty
>> files.
>>
>> Would it not be simpler to put a check in the code to validate if the
>> file
>> is blank, and if so, to completely ignore it?
>>
>
> There are multiple ways the file could be considered "blank". Maybe
> someday it would be a good idea to make ASSP entirely dummy-proof, after
> all the functionality is settled and/or we have more developers
> maintaining the code. Either way though, administrators should have an
> understanding of how Regular Expressions work, and how things can go
> wrong when they are used improperly. It's all a part of the learning
> curve.
After trying to understand the code for a while, I think I finally found
what I was looking for. Not particularly easy with the lack of comments in
the code, but eventually I think I traced it down.
I thought it might be simply to update the if statement sub ConfigCompileRE
as follows
if($new) {
SetRE($n2,$new,"is",$name);
}
else
{
${$_[0]} = "";
}
adding in the else branch in the if statement to indicate that if the $new
value is empty to blank the value of the config key (originally would have
been file:someFile), so that it would resemble the config option being blank
altogether.
But now that I think about it, I'm realizing that doing that would eliminate
ASSP's knowledge of the file altogether, so that even if subsequent changes
were made to the file contents, ASSP would never be able to reload or verify
them. Damn. I guess I can now see what you mean - without some more
in-depth recoding (ie: replace all uses of the RE variables with a call to a
function to determine if it is a valid RE or not), it becomes impossible.
There would be another couple of hacks I can think of to do this without
updating as much, but it just makes the code messier than it is already, and
I already find it extremely difficult to follow with all the double
dereferencing going on.
I guess for the moment, just have to live without files. Although, like I
said, I can see this as being problematic. I would have loved to be able to
avoid it...
Eric
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Assp-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-user