About Macrocosm
Please note: this page is retained for historical purposes. Macrocosm is currently not in development. It does power this site, it is fully functional, but it is not likely to be released in its current state as there are still bugs and I'm not entirely happy with the code behind it. I've taken all this on board and will be considering a new, slimmer version called Igloo, written from scrath in Perl. Please express your interest if you feel that the features below sound worthwhile!

What is Macrocosm?
Macrocosm is a tool for those who want to create a dynamic website without writing complicated server-side scripts. It differs from other tools such as frontpage, phpNuke and the various wikis and blogs out there in several important ways:
  • Macrocosm is unlimited
    While other web systems force the designer to adopt a specific site layout with little versatility, Macrocosm can look and feel however you want it to. Its modular design allows a designer to create a site template with specific areas for content, and then place content modules into those areas (for instance, the Menu area on this site has a menu module inside it that allows users to navigate the site). Content modules also have their own "wrapper" templates which can be used to individually customize the appearance of any Macrocosm module. Because of this, a user might never realise that a site is using Macrocosm as a back end system.
  • Macrocosm is live
    Editing of Macrocosm pages is performed via a simple web interface that appears on top of the page that is being edited. You can thus update your Macrocosm-based site from anywhere in the world on any computer or operating system that has a compatible browser (such as Mozilla 1.6, Opera 7 or above, or Internet Explorer 5 or above). As you update your Macrocosm-based site you will see the changes immediately.
  • Macrocosm is connected
    Modules in Macrocosm can be interconnected. Outputs of one module can be routed to inputs of several other modules to allow modules to communicate between oneanother. For instance, a text area module, such as the one in which you are reading this text, may have it's "body text" input connected to the output of a quote generator, which in-turn could be obtaining the index of which quote to use from a random number generator module. The result would be that the text area module shows random quotes.
    The administrator of a Macrocosm-based site can easily route module outputs and inputs via the Macrocosm administration interface.
  • Macrocosm is fast
    One of the goals while structuring Macrocosm was to make it as fast as possible. The test machine was a Celeron 333mhz with 192mb of memory running Slackware Linux 9.0, and any page render time greater than 0.1 seconds was deemed unacceptable (for pages not using databases and not in Administrator mode). The modular nature of Macrocosm ensures that only the parts of your site that are being used for the current visible page will be executed, and thus less initialization time and database queries are required per-page. Other sites perform this by having seperate cut-down scripts for smaller, less rich pages. Macrocosm does this practice inherently. Macrocosm is also compatible with mod_perl 2.0, making it extremely fast in environments that support this server extension.
  • Macrocosm is portable
    Macrocosm will run on any web server that supports Perl. Macrocosm itself requires no Perl modules that are not part of the standard Perl distribution, so you don't need to ask server admins to update their versions of Perl before you can run it. Note that some of the extension modules to Macrocosm may require certain third-party Perl modules. Since Perl is the most widely supported server-side scripting languages available on web hosts, it is extremely likely that your host will be able to run Macrocosm.
  • Macrocosm is extensible
    If Macrocosm does not support a particular feature that you would like, you could either write a module for it (in Perl) or download one that does the job. Writing modules in Macrocosm has been made as simple as possible with over 50 API functions at your disposal for handling web forms, module wrapper templates, plaintext to HTML conversion, inputs and outputs and so on.


Uh oh, "templates"?
Templating has scared designers off for some time and has lacked versatility in many areas. Macrocosm's templating system is extremely fast and simple to use. In Macrocosm templates you can do pretty much anything including loops, if statements, goto statements and define variables. Also, since Macrocosm template code is wrapped up in HTML comments, you can use a standard HTML editor package to develop your templates.

The templating process works in three stages:
  1. Macrocosm executes a module which generates several items (or variables) for use in the template.
  2. Macrocosm then takes those variables and parses the wrapper template assigned to the module. The wrapper template is HTML code with Macrocosm template directives that instruct Macrocosm as to how to insert the variables into the wrapper template. For instance, if a module generates a "body" variable, the wrapper template may have a directive that reads <!--{print body}-->, which would be replaced with the contents of the body variable at that point in the template.
  3. After parsing the wrapper templates for every module on the page, Macrocosm then inserts the resultant pure HTML for each wrapper into the main page template. The point at which it inserts the HTML is determined by where the administrator of the site has placed the module that was wrapped with this wrapper template.

Once these three steps have been performed, Macrocosm delivers the whole page as HTML to the visitor's web browser.

Default templates and wrappers will be distributed with Macrocosm and more wrappers may be obtained using Macrocosm's internal auto-update system.

Database support?
Macrocosm currently has support for MySQL databases via a database module. This module is usually used as a "global" module, which is a module that is present but hidden on every page. Modules that require MySQL support can then be connected to this module and can thus access the database. Because of the modular approach to databases, it is possible to use any database system (such as Oracle or PostGreSQL) with Macrocosm, provided there is a module that supports these databases.

Macrocosm also comes with a "flatfile" database module that allows those who do not have database access with their hosts to use a SQL-based database that operates on a file in their webspace rather than a database server. This module requires no extra Perl extensions to run, but it is strongly advised that a host with MySQL database access be used instead of the flatfile database system.

Steve Pick
Webmaster of baxpace.com and Macrocosm developer


Running on Macrocosm 1.012 (Reitsch), rendered in 0.01s