/usr/share/perl5/Mason/Manual/UpgradingFromMason1.pod is in libmason-perl 2.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | __END__
=pod
=head1 NAME
Mason::Manual::UpgradingFromMason1 - Summary of differences between Mason 1 and
Mason 2
=head1 DESCRIPTION
Mason 2.x comes ten years after Mason 1.0 (known as L<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. :))
=head1 ARCHITECTURE
=over
=item *
In Mason 1, each component was an instance of a common Component class. In
Mason 2, each component is its I<own> Moose class, with a class name generated
from the component path.
=item *
The main component body - the content and the inline Perl sections - are placed
into a C<main> method.
=item *
Calling a component (via C<< <& &> >> or C<< $m->comp >> ) entails creating a
new instance of the component class, and calling its C<main> method. Component
call parameters are passed to the constructor and placed in attributes.
=back
=head1 MAJOR FEATURES
=over
=item *
B<Plugins> now utilize Moose roles and are much more powerful and flexible than
in Mason 1. Some features that were (or would have been) in the core of Mason 1
are now in plugins. See L<Mason::Manual::Plugins|Mason::Manual::Plugins>.
=item *
B<Web integration> in Mason 1 was centered around mod_perl and was part of the
core. In Mason 2 all web integration has been split out into a companion web
framework, L<Poet>, which in turn uses L<PSGI> to integrate with any server
backend. You can also use Mason as the templating layer in popular web
frameworks such as L<Catalyst> and L<Dancer>. There is no longer anything
web-specific in the Mason core.
=item *
B<Subcomponents> have been eliminated, replaced with class methods.
=item *
B<Error processing/formatting> has been eliminated. Mason now simply throws
fatal errors to the caller. In a L<Plack|Plack> environment,
L<Plack::Middleware::StackTrace|Plack::Middleware::StackTrace> will catch the
error and format it nicely.
=item *
B<Resolvers> and B<Anonymous components> have been eliminated. Components need
to be in files. If your components live in another data source, you could use
L<FUSE|http://fuse.sourceforge.net/> or a custom plugin to keep a file
hierarchy up to date with the data source.
=item *
B<Caching> support has been simplified. C<< $m->cache >> simply returns a
L<CHI|CHI> object with an appropriate namespace for the component.
=back
=head1 SYNTAX
=over
=item *
C<< <%once> >> has been replaced with C<< <%class> >>.
=item *
C<< <%cleanup> >> has been eliminated; it was not very useful anyway, since it
was not guaranteed to run after an exception. You can use
L<add_cleanup|Mason::Request/add_cleanup> to add cleanup code for the end of
the request, which is good enough in most cases, or you can add a C<DEMOLISH>
method to the component.
=item *
Single blank lines between blocks are now removed, so you can space blocks out
for readability without generating a ton of newlines.
=item *
Whitespace is required after a %-line and around the expression in a C<< <% %>
>> tag. This improves readability and leaves open the possibility of
additional syntax.
=item *
C<< <%args> >> and C<< <%shared> >> are gone. Use Moose attributes instead.
=item *
The C<< <%ARGS> >> hash is gone, you can instead use C<< $.args >> or C<<
$self->args >> to get all the parameters passed to a component.
=item *
C<< <%method> >> and C<< <%def> >> have been replaced with just C<< <%method>
>>, which creates a true class method rather than a subcomponent.
=item *
The C<< <%filter> >> tag is now used to define filters, instead of
automatically applying a filter to the current component.
=item *
C<< Components with content >> syntax has been eliminated; use the
L<CompCall|Mason::Filters::Standard/CompCall> filter instead.
=item *
C<< Escape flags >> in substitution tags now utilize
L<filters|Mason::Manual::Filters>.
=back
=head1 MISC PARAMETER CHANGES
=head2 Interp parameters
=over
=item *
C<buffer_preallocate_size>, C<code_cache_max_size> and C<use_object_files> have
been deemed unnecessary and eliminated.
=item *
C<escape_flags> has been eliminated; define filters instead.
=item *
C<data_dir> now defaults to a directory created with
L<tempdir|File::Temp/tempdir>.
=item *
C<preloads> has been eliminated; this code does roughly the same:
$interp->load($_) for (grep { /some_condition/ } $interp->all_paths);
=back
=head2 Request parameters
=over
=item *
C<autoflush> and C<max_recurse> have been eliminated because they are too
difficult to implement efficiently.
=back
=head2 Compiler parameters
=over
=item *
C<preprocess>, C<postprocess_perl>, and C<postprocess_text> have been
eliminated; similar effects can be achieved with plugins targeting
L<Mason::Compilation|Mason::Compilation>.
=item *
C<default_escape_flags> has been eliminated, but see
L<Mason::Plugin::DefaultFilter|Mason::Plugin::DefaultFilter> for a third-party
substitute.
=back
=head1 MISC METHOD CHANGES
=head2 Interp methods
=over
=item *
C<exec> has been renamed to L<run|Mason::Interp/run>.
=back
=head2 Request methods
=over
=item *
C<cache_self> has been eliminated; use the L<Cache filter|Mason::Plugin::Cache>
instead.
=item *
C<callers>, C<caller> and C<caller_args> have been eliminated; now that
component calls are simply method calls underneath, they are too difficult to
implement efficiently.
=item *
C<call_next> has been replaced with Moose's C<inner>.
=item *
C<call_self> has been eliminated; use L<filters|Mason::Manual::Filters>
instead.
=item *
C<current_comp> has been eliminated. Within a component, use C<< $self >>;
outside a component you can call
L<current_comp_class|Mason::Request/current_comp_class>, which will at least
get you the class.
=item *
C<dhandler_arg> has been renamed to L<path_info|Mason::Request/path_info>.
=item *
C<exec> has been renamed to L<run|Mason::Request/run>.
=item *
C<fetch_comp> has been renamed to L<load|Mason::Request/load>.
=item *
C<subexec> has been replaced with L<visit|Mason::Request/visit> and
L<go|Mason::Request/go>.
=back
=head1 SEE ALSO
L<Mason|Mason>
=head1 AUTHOR
Jonathan Swartz <swartz@pobox.com>
=head1 COPYRIGHT AND LICENSE
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.
=cut
|