NAME

Plack::Middleware::MCCS - Middleware for serving static files with 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 mccs in the form of a Plack middleware. It allows for more flexibility with regards to which paths are to be served by mccs, as it can serve requests based on regular expressions rather than a path prefix.

CONFIGURATION

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 include:

  • root: the root directory from which to serve static files. Defaults to the current working directory.

  • opts: a hash-ref of options to pass to Plack::App::MCCS's constructor. Refer to it for a complete list.

METHODS

call( \%env )

Attempts to serve a static file via 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

mccs, 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.