Mason::Manual::UpgradingFromMason1(3pm) User Contributed Perl Documentation Mason::Manual::UpgradingFromMason1(3pm)

Mason::Manual::UpgradingFromMason1 - Summary of differences between Mason 1 and Mason 2

Mason 2.x comes ten years after Mason 1.0 (known as HTML::Mason) and twelve years after the original Mason release. It has been rearchitected and reimplemented from the ground up.

That said, the philosophy and core syntax are similar enough that it should still be recognizable and "feel like Mason" to existing users.

This manual attempts to summarize the differences between Mason 1 and 2, to help existing users decide if they are interested and, if so, migrate their projects.

There is currently no automated way to convert a Mason 1 to a Mason 2 site, but there hopefully will be someday. (Contributions welcome. :))

  • "buffer_preallocate_size", "code_cache_max_size" and "use_object_files" have been deemed unnecessary and eliminated.
  • "escape_flags" has been eliminated; define filters instead.
  • "data_dir" now defaults to a directory created with tempdir.
  • "preloads" has been eliminated; this code does roughly the same:

        $interp->load($_) for (grep { /some_condition/ } $interp->all_paths);
        

"autoflush" and "max_recurse" have been eliminated because they are too difficult to implement efficiently.

  • "preprocess", "postprocess_perl", and "postprocess_text" have been eliminated; similar effects can be achieved with plugins targeting Mason::Compilation.
  • "default_escape_flags" has been eliminated, but see Mason::Plugin::DefaultFilter for a third-party substitute.

"exec" has been renamed to run.

  • "cache_self" has been eliminated; use the Cache filter instead.
  • "callers", "caller" and "caller_args" have been eliminated; now that component calls are simply method calls underneath, they are too difficult to implement efficiently.
  • "call_next" has been replaced with Moose's "inner".
  • "call_self" has been eliminated; use filters instead.
  • "current_comp" has been eliminated. Within a component, use $self; outside a component you can call current_comp_class, which will at least get you the class.
  • "dhandler_arg" has been renamed to path_info.
  • "exec" has been renamed to run.
  • "fetch_comp" has been renamed to load.
  • "subexec" has been replaced with visit and go.

Mason

Jonathan Swartz <swartz@pobox.com>

This software is copyright (c) 2012 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2022-05-27 perl v5.34.0