THE CASM FAQ ============ by Laszlo Gerencser casm@mailbox.hu http://casm.portologic.hu Updated on 2003.11.28 Up-to-date version is available at the CASM website and in the latest CASM release. CONTENTS -------- - GENERAL QUESTIONS - SYSTEM REQUIREMENTS AND COMPATIBILITY - CONTENT ASSEMBLING LANGUAGE - SITE BUILDING AND MAINTENANCE - PROBLEMS AND ERRORS GENERAL QUESTIONS ----------------- Q: What is this CASM thing? A: RTFM (beginners should type "casm -d | more" in the commandline) Q: Why should I use CASM? A: Because it's cool! ;-) Q: What is it for? A: Its primary purpose is to make the creation and maintenance of large websites an easy, quick and enjoyable task. But you can use it for other purposes as well, since it's a generic off-line content management tool. I compile CASM with itself for example. It can be used with binary content data also. Just read the documentation and try it. You will see whether it is for you or not. Q: Why another website maintaining utility? A: CASM is NOT just another website maintaining utility. It's far more than that. Well, I tell you the story. I worked for an Internet company. I noticed that creating and especially maintaining large websites is a very time consuming task. Everyone hates it. And this leads to many minor bugs in the site itself. Deadlines, neverending testing/bughounting cycles: it was not so funny for me. I was the responsible guy, so I had to do something. And I did. I generally like to define languages to special purposes. It's a Good Thing. Or at least it sounds cool ;-). I defined PDDDL to make the developers' live easier. PDDDL is a dynamic content description language that can be used in CGI scripts to separate HTML templates from data content.Our senior developer hacked a PDDDL interpreter and it worked. We were happy with it. But what about HTML templates or static sites? Well, it was clear that we need some PDDDL-like stuff. We looked for some web site maintaining utility, but we didn't find anything really cool. That's why I created CASM. I defined the Content Assembling Language, wrote a compiler, an optimizer and some minor features. And it worked. It worked cool. We used it for HTML templates and static websites. And I was regularry grateful to spending my time on developing CASM. Q: Is it stable? A: Yes, it is. It has minor cosmetic bugs, nothing serious. But, hey! It has more than 2000 lines of code! Seriously: we used it in production. We relied on it. But read the license before use. There is no warranty of any kind! Q: Do you plan to create a GUI for CASM? A: No. Never. It's a native commandline tool. Use Xterm if you need a graphical interface ;-) Q: Is it free? A: Yes, it is. Read the license. Q: Why not GPL/LGPL/AnyOtherLicese? A: I hate legal stuff. It's free. You have the source. What more? Q: Do you maintain it? A: When I have time and I feel like doing it. But I cannot guarantee anything. You have the source. It's full of comments. You can hack it if you like. Anyway I'm happy to hear about bugs and also happy to get patches. Drop me a mail, we will discuss it. SYSTEM REQUIREMENTS AND COMPATIBILITY ------------------------------------- Q: What are the hardware/software requirements of CASM? A: An average PC hardware is enough. CASM processes the files in the memory, so if you have large sources, you need enough RAM to do it. As a rough rule, you need largest_source_file_size * 2 RAM. It will be enough. The operating system should be posix-compatible. A Perl interpreter is required (version 5.005 or higher) since CASM is written in Perl. You need a posix cp command accepting -rp flags aslo. Nothing else. CASM was developed on a small Linux box. Q: It works on Windows/Macintosh/AnyOtherSystem? A: It is reported to run on Windows XP under the most recent version of Cygwin. It should run on other Windowses with Cygwin as well. It seems running on Mac OS X. Other non-posix platforms: I don't know. If the platform has a posix environment or emulation then CASM should run on it. Try it and drop me a mail. Q: It works with HTML/WML/XML/SGML/CSS/Java/Javascript/PHP/ASP/AnyOtherFileType? A: Yes. Even with binary data. It's independent from file format you use. Q: Is it compatible with MySQL/PostgreSQL/Oracle/AnyOtherDBMS? A: Yes. Since it has nothing to do with databases :-) CONTENT ASSEMBLING LANGUAGE (CAL) --------------------------------- Q: What is CAL? A: Content Assembling Language (CAL) is a markup language designed to separate site content from display properties. CAL has a comfortable templating mechanism, if-then-else structure, variable substitution, file include, recordset handling, looping functions and more. Q: Why it is so complicated? A: It is not so complicated. Try to use it, and you will see yourself. But first of all: read the documentation! Q: I don't like CAL syntax. Can I modify it? A: Yes, you can. Get the CASM source, open the casm_cal.pli file, and go to the line containing the '(You can alter CAL syntax here)' string. And do it for your pleasure. If you want to modify it more deeply, you have to hack the _CompileCal subroutine also. SITE BUILDING AND MAINTENANCE ----------------------------- Q: How can I use CASM to build a multilingual site? A: Use common template and different content files. Define layout in the template file and multilingual content in different content files. Use a CAL variable to indicate the language and you are able to do different things in the template based on the language. Q: It's annoying to type the command issuing CASM everytime. What should I do? A: Write a shell script! It can help you a lot. I use a shell script like this to rebuild the CASM website: #!/bin/bash -v ##################### DELETING Upload DIRECTORY rm -r ./Upload; ##################### COPYING Source TO Uploaad cp -rp ./Source ./Upload; ##################### DELETING ~cal_files DIRECTORY FROM Upload rm -r ./Upload/~cal_files; ##################### DELETING *.cal FILES FROM Upload find ./Upload -name '*.cal' -exec rm {} \; ; ##################### OPTIMIZING css FILES ./casm -RH s:./Source/*.css t:./Upload/*; ##################### COMPILING html.cal FILES ./casm -RCH s:./Source/*.html.cal t:./Upload/*.html; PROBLEMS AND ERRORS ------------------- Q: I cannot run CASM. Why? A: Well, without knowing the error message... Maybe CASM has no execute permission in your filesystem. Maybe you are not allowed to run scripts from the directory where CASM resides. Perhaps you have no Perl v. 5.0.x or above in your system, or you have no permission to run it. It is possible that Perl interpreter is not in /usr/bin on your system. Check the aboves, and try to understand the error message you have got. Q: The error message is something like "bad interpreter" or so. A: The Perl interpreter is not in /usr/bin. Do the following: - Locate the perl interpreter (issue the "which perl" command in the console) - Open the casm program file with a text editor - Modify the string /usr/bin/perl in the first line. It has to point to the Perl interpreter in your system. - Save the file. - Run it. -- Do you have a question not covered by this F.A.Q.? Send me a mail, and I'll include it with the right answer.