The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MasonX::StaticBuilder -- Build a static website from Mason components

SYNOPSIS

    use MasonX::StaticBuilder;
    my $tree = MasonX::StaticBuilder->new($input_dir);
    $tree->write($output_dir, %args);

DESCRIPTION

Ever had to develop a website to deploy on a host that doesn't have Mason? I have. The most crazy-making thing about it is that you desparately want to use all the Mason tricks you're used to, but you can't even do:

    <& header &>

AUGH!

Well, this fixes it.

Do your work in one directory, using whatever Mason stuff you want. Then use MasonX::StaticBuilder to build a static website from it.

(Obviously you can also use this for non-web purposes.)

The following Mason features are tested and known to work in this release:

  • Evaluation of expressions in <% %>

  • Args blocks

  • Init blocks

  • Inclusion of components using <& &>

  • Autohandlers

The following are not known to work (and I'm not sure they even make sense):

  • dhandlers

Anything not on that list means it's not something I regularly use, and I don't have a test for it yet. Additions to the test suite to cover these other areas of Mason functionality are very welcome.

METHODS

new()

A simple constructor. Pass it the directory where the components are to be found.

Note: if the directory doesn't exist, or whatever, this will return undef.

write()

Expand the template directory and write it out to the specified output directory, passing any additional args to the mason components it finds.

BUGS

I haven't tested a wide range of Mason functionality, just the stuff I regularly use. Patches welcome.

The best way to report bugs on this software is vy the CPAN RT system at http://rt.cpan.org/

AUTHOR

Kirrily Robert, skud@cpan.org

LICENSE

This module is distributed under the GPL/Artistic dual license, and may be used under the same terms as Perl itself.