|
Hints & Troubleshooting
This section gives you some hints, offers some tricks, and attempts to help you troubleshoot problems that you may encounter. If this page does not address what you were hoping to find here, please email us with your suggestions & questions. (We can't read minds, but we do read email!)
Performance
- The html-image.wl specifies a construct that will help you build HTML images in a flexible and clever manner. There is no rule, however, that says that you must use this flexible construct merely because it is available. In fact, the use of any clever-yet-complicated construction brings with it a performance penalty: WebLord needs to evaluate a lot of recursive references, perform the various required lookup, string processing operations, etc. Sometimes a very simple text object that specifies the HTML <img> tag is all you really need, and it will evaluate a lot faster, too!
- Objects that do not change, i.e. that do not reference values outside of themselves, or values that change from one reference of the object to the next; these objects can be declared static so that after the first reference they are evaluated much quicker. A static object, of course, becomes "frozen" after the first time it is invoked. Make sure you don't plan to have the object act differently when invoked by different parent objects!
Maintenance
- A large site definition file can frequently become a bit unwieldy. There are a number of ways to reduce the complexity of the files:
- Break up your site into multiple files and include each from a "master" site description file.
- Move larger sections of text into external files, then read them in with an object. You can still reference properties with a ${...} sequence. This is especially valuable when you include the body of pages from an external file and let WebLord manage a consistent layout for you.
- When you have many string constants, it may be useful to use the alternate » ... « quotes to leave you free to type any number of double (") and single (') quotes in your strings. These quotes are part of the ISO-8859-1 (Latin-1) character set that has been standard on the Amiga since 1985 and has become the foundation for the World Wide Web. This is also the base for the Unicode character set. Any modern operating system should support ISO-8859-1.
- We have found that when developing a site it is often more informative to run WebLord with a quiet argument and stats in most situations. While we work on tuning the pages, we like to then add the noupdate argument which suppresses the updating of the Page Signature Database. When we are finally ready to upload the completed pages to our website for real, we remove the noupdate argument from the command line and add postexec: the Page Signature Database is then updated and the pages are uploaded (via the commands given in the post-exec property) and made publically available. Works like a charm!
- WebLord runs quite well as a CGI program on our web server: we invoke it through a shell script that specifies the arguments that WebLord needs to build the page. When WebLord runs in cgi mode, it does not write pages to disk (it ignores the output property) because it makes no sense in this context to write these pages when they are always rebuilt with each call.
- Reading the result of an external command into an object using quite flexible platform independence. A number of nifty features are demonstrated here, too, which is why this whole thing looks so "complicated":
# - Executes the result of the 'list-jokes' object
# - Names the working file "scratch.dat"
# - If "scratch.dat" already contains the information and no EXEC
# is necessary, then you only need the 'read-directory-listing'
# object (and leave the 'exec-cleanup' property out!)
text = read-directory-listing
{
exec = list-jokes;
value = "scratch.dat";
value-type = "plainfile";
exec-cleanup = DELETE-FILE( filename = value );
}
# - uses the parent object's value property to store the result of
# the external call (this is part of operating support: notice
# the I/O redirection symbol >
text = list-jokes
{
select-case = _OS;
case:AMIGA = "c:dir work:jokes/#?.text >" parent.value;
case:UNIX = "/bin/ls -l ~/jokes/*.text >" parent.value;
case:WIN32 = "dir c:\jokes\*.text >" parent.value;
case: = ERROR( text = "No jokes for platform " _OS );
}
# - does similar stuff as the 'list-jokes' object except that we
# have defined the DELETE-FILE object to be usable as either a
# macro (naming the filename explicitly and in the process
# overriding the locally defined default for 'filename') or it
# will use the local filename, which references the parent's
# 'value' property (which better be a filename :-)
text = DELETE-FILE
{
select-case = _OS;
case:AMIGA = "c:delete " filename;
case:UNIX = "/bin/rm -f " filename;
case:WIN32 = "del " filename;
case: = ERROR( text = "Cannot delete on platform " _OS );
filename = parent.value;
}
# - Both 'list-jokes' and 'DELETE-FILES' above reference this handy
# error message macro: simply set the "text" argument property to
# the value of the message.
text ERROR
{
echo = ERROR++ "In '" parent.objectname "': " text;
value = "";
}
- ERROR: Unacceptable property name: '...'
You are either using symbols such as '.' (period) or other special characters in the named property, or (more often than not) you forgot a terminating semicolon at the end of the preceding property.
|