/usr/share/perl5/Mason/App.pm 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 | package Mason::App;
{
$Mason::App::VERSION = '2.21';
}
use Cwd qw(realpath);
use File::Basename;
use File::Temp qw(tempdir);
use Getopt::Long;
use Mason;
use Mason::Util qw(json_decode);
use strict;
use warnings;
my $usage =
"usage: $0 [--data-dir dir] [--plugins Plugin1,Plugin2] [--args json-string] [-e source] [template-file]";
sub run {
my ( %params, $args, $source, $help );
GetOptions(
'args=s' => \$args,
'e=s' => \$source,
'h|help' => \$help,
map { dashify($_) . "=s" => \$params{$_} } qw(data_dir plugins)
) or usage();
if ($help) {
system("perldoc $0");
exit;
}
%params = map { defined( $params{$_} ) ? ( $_, $params{$_} ) : () } keys(%params);
if ( $params{plugins} ) {
$params{plugins} = [ split( /\s*,\s*/, $params{plugins} ) ];
}
my %run_args = defined($args) ? %{ json_decode($args) } : ();
my $tempdir = tempdir( 'mason-XXXX', TMPDIR => 1, CLEANUP => 1 );
my $file;
if ($source) {
$file = "$tempdir/source.mc";
open( my $fh, ">", $file );
print $fh $source;
}
else {
$file = shift(@ARGV);
usage() if @ARGV;
if ( !$file ) {
$file = "$tempdir/stdin.mc";
open( my $fh, ">", $file );
while (<STDIN>) { print $fh $_ }
}
}
my $comp_root = dirname($file);
my $path = "/" . basename($file);
my $interp = Mason->new( comp_root => $comp_root, autoextend_request_path => 0, %params );
print $interp->run( $path, %run_args )->output . "\n";
}
sub usage {
print "$usage\n";
exit;
}
sub dashify {
my $name = shift;
$name =~ s/_/-/g;
return $name;
}
1;
__END__
=pod
=head1 NAME
Mason::App - Implementation of bin/mason
=head1 DESCRIPTION
See documentation for bin/mason.
=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
|