As an alternative to the object-oriented interface, text containing MicroMason markup code can be compiled and executed by calling the following functions.

Please note that this interface is maintained primarily for backward compatibility with version 1 of Text::MicroMason, and it does not provide access to some of the newer features.

Each function creates a new MicroMason object, including any necessary traits such as Safe compilation or CatchErrors for exceptions, and then passes its arguments to an appropriate method on that object.

You may import any of these functions by including their names in your use Text::MicroMason statement.

Both compilation and run-time errors in your template are handled as fatal exceptions. The provided try_execute() and try_compile() functions use a mixin class which wraps an eval { } block around the basic execute() or compile() methods. In a scalar context they return the result of the call, or undef if it failed; in a list context they return the results of the call (undef if it failed) followed by the error message (undef if it succeeded). For example: