This file is indexed.

/usr/share/perl5/HTML/Mason/Utils.pm is in libhtml-mason-perl 1:1.54-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
# Copyright (c) 1998-2005 by Jonathan Swartz. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.

#
# Miscellaneous Mason-related utilities expected to be used by
# external applications.
#

package HTML::Mason::Utils;
{
  $HTML::Mason::Utils::VERSION = '1.54';
}

use HTML::Mason::Tools qw(compress_path);
use strict;
use warnings;

require Exporter;

use vars qw(@ISA @EXPORT_OK);

@ISA = qw(Exporter);
@EXPORT_OK = qw(data_cache_namespace cgi_request_args);

sub data_cache_namespace
{
    my ($comp_id) = @_;
    return compress_path($comp_id);
}

sub cgi_request_args
{
    my ($q, $method) = @_;

    my %args;

    # Checking that there really is no query string when the method is
    # not POST is important because otherwise ->url_param returns a
    # parameter named 'keywords' with a value of () (empty array).
    # This is apparently a feature related to <ISINDEX> queries or
    # something (see the CGI.pm) docs.  It makes my head hurt. - dave
    my @methods =
        $method ne 'POST' || ! $ENV{QUERY_STRING} ? ( 'param' ) : ( 'param', 'url_param' );

    foreach my $key ( map { $q->$_() } @methods ) {
        next if exists $args{$key};
        local $CGI::LIST_CONTEXT_WARN = 0;
        my @values = map { $q->$_($key) } @methods;
        $args{$key} = @values == 1 ? $values[0] : \@values;
    }

    return wantarray ? %args : \%args;
}


1;

__END__

=pod

=head1 NAME

HTML::Mason::Utils - Publicly available functions useful outside of Mason

=head1 VERSION

version 1.54

=head1 DESCRIPTION

The functions in this module are useful when you need to interface
code you have written with Mason.

=head1 FUNCTIONS

=over 4

=item data_cache_namespace ($comp_id)

Given a component id, this method returns its default
C<Cache::Cache> namespace.  This can be useful if you want to access
the cached data outside of Mason.

With a single component root, the component id is just the component
path. With multiple component roots, the component id is
C<key>/C<path>, where C<key> is the key corresponding to the root that
the component falls under.

=item cgi_request_args ($cgi, $method)

This function expects to receive a C<CGI.pm> object and the request
method (GET, POST, etc).  Given these two things, it will return a
hash in list context or a hashref in scalar context.  The hash(ref)
will contain all the arguments passed via the CGI request.  The keys
will be argument names and the values will be either scalars or array
references.

=back

=head1 SEE ALSO

L<Mason|Mason>

=head1 AUTHORS

=over 4

=item *

Jonathan Swartz <swartz@pobox.com>

=item *

Dave Rolsky <autarch@urth.org>

=item *

Ken Williams <ken@mathforum.org>

=back

=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