Using Mason on Panix


These instructions outline how to set up the HTML::Mason templating system to generate dynamic web pages for your site on our shared webservers. Substitute your user name for yourusername, and, where appropriate, your domain name for yourdomainname, throughout.

  1. Log into your Panix shell account.
  2. Change directories into your web space:
    •If you have a 'webspace' link in your home directory:
    If you have a domain, your directory is the one you chose when you signed up for the service. The default is the domain with the TLD chopped off, e.g. for example.com, the directory would be 'example', so in that case
    cd webspace/example
    If you do not have a 'webspace' link:
    • Personal & Cheap-web customers:
    cd public_html
    • Standard, Advanced, and Developer Web customers:
    cd corp-web/yourdomainname
  3. If you do not already have one, create a pcgi-bin directory:
    mkdir pcgi-bin
    chmod 701 pcgi-bin/
  4. Create a Mason handler: edit pcgi-bin/mason-handler.cgi (substitute your user name for yourusername)
    #!/usr/local/bin/perl5.20.2
    $ENV{ PATH_INFO } =~ s{/~\w+}{};
    use HTML::Mason::CGIHandler;
    • Personal Web & Cheap-web customers:
    my $h = new HTML::Mason::CGIHandler(comp_root=>'/htdocs/userdirs/yourusername');
    • Standard, Advanced, and Developer Web customers:
    my $h = new HTML::Mason::CGIHandler(comp_root=>'/htdocs/yourusername/yourdomainname');
    $h->handle_request;
  5. Adjust permissions on your new handler:
    chmod 500 pcgi-bin/mason-handler.cgi
  6. Tell apache about the new handler: append to or create a .htaccess file (substitute your user name for yourusername) these 2 lines.
    AddHandler html-mason mhtml
    • Personal Web customers:
    Action html-mason /~yourusername/pcgi-bin/mason-handler.cgi
    • Cheap-web, Standard, Advanced, and Developer Web customers:
    Action html-mason /pcgi-bin/mason-handler.cgi
  7. Create .mhtml files, such as www.panix.com/~ejetest/mason-test.mhtml, with autohandlers and include files to your taste. Minimum permissions on the new files are 400 (owner-readable). You might prefer 600 (which is also owner-writeable) for convenience while actively working with your files.
    > cat mason-test.mhtml
    <dl>
    <%perl>
    foreach my $key (sort keys %ENV) {
    </%perl>
    <dt><% $key %></dt><dd><% $ENV{$key} %></dd>
    <%perl>
    }
    </%perl>
    </dl>

    > cat autohandler
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
    <title><% $m->request_comp->attr('title') %></title>
    </head>
    <body>
    <% $m->call_next() %>
    </body>
    </html>
  8. Get help online. www.masonhq.com/


Last Modified:Tuesday, 22-Feb-2022 08:47:30 EST
© Copyright 2006-2021 Public Access Networks Corporation