The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Plack::Middleware::MCCS - Middleware for serving static files with Plack::App::MCCS

EXTENDS

Plack::Middleware

SYNOPSIS

# in your app.psgi:
use Plack::Builder;

builder {
	enable 'Plack::Middleware::MCCS',
		path => qr{^/static/},
		root => '/path/to/static_files';
	$app;
};

DESCRIPTION

This package allows serving static files with Plack::App::MCCS in the form of a middleware. It allows for more flexibility with regards to which paths are to be served by MCCS, as the app can only be mounted onto a certain path prefix. The middleware, however, can serve requests that match a certain regular expression.

CONFIGURATIONS

The only required configuration option is path. You should either provide a regular expression, or a subroutine to match against requests. For more info about the path option, look at Plack::Middleware::Static, it's exactly the same.

Other configuration options are those supported by Plack::App::MCCS. None are required, but you will mostly provide the root option. If you do not provide it, the current working directory is assumed. These are the supported options:

  • root

  • defaults

  • types

  • encoding

  • min_cache_dir

Refer to Plack::App::MCCS for a complete explanation of them.

METHODS

call( \%env )

Attempts to handle a request by using Plack::App::MCCS.

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-Plack-App-MCCS@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Plack-App-MCCS.

SEE ALSO

Plack::App::MCCS.

AUTHOR

Ido Perlmuter <ido@ido50.net>

ACKNOWLEDGMENTS

This module is just an adapation of Plack::Middleware::Static by Tatsuhiko Miyagawa to use Plack::App::MCCS instead.

LICENSE AND COPYRIGHT

Copyright (c) 2011-2023, Ido Perlmuter ido@ido50.net.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.