This file is indexed.

/usr/share/perl5/Mason/Manual/FAQ.pod is in libmason-perl 2.19-2.

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
__END__
=pod

=head1 NAME

Mason::Manual::FAQ - Frequently asked questions about Mason

=head1 COMPONENTS

=head2 Can I create global variable(s) that can be seen from all components?

Mason components each run in their own packages, so if you set a regular global
in one you won't be able to see it in the others.

But you can use L<allow_globals|Mason::Interp/allow_globals> and
L<set_global|Mason::Interp/set_global> to create globals accessible from all
components.

=head2 Why does my output have extra newlines/whitespace and how can I get rid of it?

See L<Whitespace And Newlines|Mason::Manual::Syntax/WHITESPACE_AND_NEWLINES> in
the syntax manual. To suppress extra newlines you can use a backslash at the
end of each line, or you can use the
L<NoBlankLines|Mason::Filters::Standard/NoBlankLines> filter.

To emit binary data without the risk of inserting extra whitespace, surround
your code with L<$m-E<gt>clear_buffer|Mason::Request/clear_buffer> and
L<$m-E<gt>abort|Mason::Request/abort>:

    <%init>
    $m->clear_buffer;
    open(my $fh, '<', 'binary-file') or die $!;
    my $buffer;
    while (read $fh, $buffer, 8192) {
        $m->print($buffer);
    }
    $m->abort;
    </%init>

=head2 I'm trying to generate an image or other binary file, but it seems to be getting corrupted.

This is almost always caused by unwanted whitespace or other output at the
beginning or end of your binary data. Use
L<$m-E<gt>clear_buffer|Mason::Request/clear_buffer> and
L<$m-E<gt>abort|Mason::Request/abort> as in previous answer.

=head2 How do I put comments in components?

See L<Comments|Mason::Manual::Syntax/COMMENTS> section in the syntax manual for
reference.

=over

=item *

Put general comments in the C<< <%doc> >> section.

=item *

Within code blocks (C<< <%class> >>, C<< <%init> >>, C<< <%perl> >>, etc.), use
standard Perl comments ('#').

=item *

Use C<< <% # %> >> for single or multi-line comments anywhere outside of Perl
sections.

=item *

If you are producing HTML, you can use standard HTML comments delimited by <!--
-->. The difference is that these comments will appear in the final output.

=back

=head2 What's a good way to temporarily comment out code in a component?

For HTML, you might be tempted to surround the section with C<< <!-- --> >>.
But be careful! Any code inside the section will still execute. Here's a
example of commenting out a call to an ad server:

    <!-- temporarily comment out
    <& /shared/fetch_ad.mi &>
    -->

The ad will still be fetched and counted, but not displayed!

A better way to block out a section is C<if (0)>:

    % if (0) {
      ...
    % }

Code blocked out in this way will neither be executed nor displayed, and
multiple C<if (0)> blocks can be nested inside each other (unlike HTML
comments).

Another way to block out code is with a C<< <%doc> >> tag, although this not
cannot be nested.

=head2 How can I capture the output of a component (and modify it, etc.) instead of having it automatically output?

Use L<$m-E<gt>scomp|Mason::Request/scomp>.

=head2 How can I capture the output from arbitrary code that calls components, etc.?

Use L<$m-E<gt>capture|Mason::Request/capture>.

=head2 How can I get a list of components matching a path pattern?

Use L<$m-E<gt>glob_paths|Mason::Interp/glob_paths>, e.g.

    my @paths = $m->glob_paths('/some/comp/path/*');

This will work even with multiple component roots; you'll get a combined list
of all matching component paths in all component roots.

=head2 How can I access $m (the request object) from outside a component, e.g. inside a regular class?

Use L<Mason::Request-E<gt>current_request|Mason::Request/current_request>:

    package Foo;

    sub bar {
        my $m = Mason::Request->current_request;
    }

=head2 When using multiple component roots, is there a way to explicitly call a component in a specific root?

Multiple component roots were designed to work just like Perl's C<@INC>. A
given component path matches exactly one file, the first file found in an
ordered search through the roots. There is no way to explicitly ask for a file
in a specific root.

=head1 HTTP and HTML

=head2 How do I use Mason to process web requests?

You need to use Mason in conjunction with a web framework. L<Poet> is a web
framework designed specially for Mason.  L<Catalyst> and L<Dancer> can also use
Mason for their templating layer. See L<Mason::Manual::Setup>.

=head2 How can I HTML-escape the output of C<< <% %> >> tags?

See the C<H> filter in
L<Mason::Plugin::HTMLFilters|Mason::Plugin::HTMLFilters>. If you want to do
this automatically for all C<< <% %> >> tags, see
L<Mason::Plugin::DefaultFilter|Mason::Plugin::DefaultFilter>.

=head2 Why is Mason so slow with standard CGI?

Under standard CGI you must load all modules and initialize your environment
with every request. Mason's startup cost (mostly due to L<Moose|Moose>) will
make this particularly sub-optimal. Ask yourself whether you absolutely have to
use CGI, and if not, switch to a persistent solution like mod_perl or Fast CGI
or L<Starman|Starman>.

=head1 SEE ALSO

L<Mason|Mason>

=head1 AUTHOR

Jonathan Swartz <swartz@pobox.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 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