The Mason Script wobject provides the ability to run perl-based Mason components (in standalone mode) as a WebGUI wobject. This wobject brings together the power of WebGUI with the flexibility of scripted server pages.
Mason is a server side scripting environment which provides a PHP, ASP, JSP like environment in the perl language. Full documentation on Mason can be found at http://www.masonhq.com. Please review the documentation found there, paying close attention to the sections on running Mason as a standalone script as certain functionality (e.g., $m variable) is not available in the MasonScript wobject. A Mason script consists of HTML with embedded perl code. There are a variety of different mechanisms for doing such, but the most common are:hello, <%perl> print "world"; my $today = "day"; </%perl> <br>Today % print "is a beautiful "; <% $today %> <br>WobjectId = <% $session{wobject}{wobjectId} %> <br>Username = <% $session{user}{username} %>This would yield
hello, world Today is a beautiful day WobjectId = RnEvWuXFQ9LDjUaGhk-wlg Username = AdminPlease note that the WebGUI %session variable is available to your MasonScript wobjects and has been further extended to include the following wobject specific values:
Mason Script code has full access to the WebGUI and Perl environment (including the ability to read files and use Perl modules). Therefore, privileges to edit Mason Script wobjects is provided only to WebGUI Admins or members of a Script Editors group (groupId indicated by the optional WebGUI conf file setting of script_editors_group as in script_editors_group = 3).
The Mason Script wobject has been tested on the Windows 6.2.7 zip-and-go. A 5.5.x version is also available, but lacks templates, internationlization, and/or help files.
Comments and questions welcome, but I have limited time to pursue enhancements. However, I'm also toying with reimplementing this wobject with Text::MicroMason instead of the full blown HTML::Mason for security reasons. Apparently, MicroMason is more lightweight, can be configured to support HTML::Template like syntax, and can be configured to run in a safe mode sandbox. If you have any experience with Text::MicroMason, please let me know.
Special thanks to josh_johnson and scb for their feature/functionality suggestions. Special thanks to raidro for canEdit bugfixs and data_dir suggestion
Installation
Follow included instructions. HTML::Mason modules is included in tar file. However, if you don't seem to have all prequisites, you my try installing it from CPAN issuing: perl -MCPAN -e "install HTML::Mason"
Changelog
MasonScript 1.0.2 - December 3, 2004
To upgrade, copy the MasonScript.pm file overtop the existing file
Bugfix for canEdit call in formatErrorMesssage()
MasonScript 1.0.1 - December 2, 2004
To upgrade, copy the MasonScript.pm file overtop the existing file
Bugfix for canEdit call and adds ability to specify mason data_dir in WebGUI conf file. Ability to specify mason comp_root in WebGUI conf file still available from 1.0.0