Apache2-Response-FileMerge
view release on metacpan or search on metacpan
lib/Apache2/Response/.svn/text-base/FileMerge.pm.svn-base view on Meta::CPAN
# Later, in foo/bar.js:
/** Include languages/{var}/foobar_text.js **/
# Resolves to:
/** Include languages/example/foobar_text.js **/
=head1 URI PROTOCOL
The generall usefulness of the advanced URI protocol is to combine
files that are seemingly not dependant upon one another. See
the EXAMPLES section for more details on this.
=head1 TROUBLESHOOTING AND COMMON ISSUES
=item1 File name too large errors
There is a common barrier with Apache (v1+, v2+) servers (also others,
though Apache is the most susceptible) where you will be served a
Forbidden page rather than the requested JS/CSS source when a file
name grows larger than 256 characters. When combining multiple files
with deep relative path locations, this is an easy threshold to cross.
A work-around to this issue is by using variable substitution to
put the file-name as a query string parameter rather than the file name,
where the total lenght of a URI isn't limited as tightly as the file name
itself.
For example:
http://yourdomain.com/js/dir.dir2.dir<.. 256 characters later>.dirn.file.js
Can be altered to:
http://yourdomain.com/{file}/?file=js/dir.dir2.dir<.. 256 characters later>.dirn.file.js
The big, big caveat being that the current implementation of this module
will only process varaibles once and in a single-dimension. Therefore, if you
are troubleshooting a URL that already utilizes variable substitution, such as:
http://yourdomain.com/js/{lang}.dir.dir2.dir<.. 256 characters later>.dirn.file.js?lang=en
And you attempt to convert it to:
http://yourdomain.com/{file}/?file=js/{lang}.dir.dir2.dir<.. 256 characters later>.dirn.file.js&lang=en
The "lang" variable will not be substitued as it lies within the querystring rather than the path. For
these cases, we recommend you put the secondary variable substitution into an "Include" rather than
the path, which should be sufficient in most cases.
=head1 KNOWN ISSUES
=over
=item mod_perl v1.x
This will only work as a mod_perl 2.x PerlResponseHandler. If there
is demand for 1.x, I will take the time to dynamically figure out
what the right moduels, API, etc to use will be. For now, being that
/I/ only use mod_perl 2.x, I have decided to not be overly clumsy
with the code to take into consideration a platform people may not use.
=item CPAN shell installation
The unit tests each require L<Apache::Test> to run. Yet, there are a
lot of conditions that would prevent you from actually having mod_perl
installed on a system of which you are trying to install this module.
Although I don't really see the need or think it's good practice to
install Apache2 namespaced modules without mod_perl, I have not made
Apache::Test a prerequisite of this module for the case I mentioned
earlier. That said, no unit tests will pass without mod_perl already
installed and therefore will require a force install if that is what
you would like. If that method is preferred, it is always possible
to re-test the module via the CPAN shell once mod_perl is installed.
At the time of this writing, L<Apache::Test> is included with the
mod_perl 2.x distribution.
=back
=head1 SEE ALSO
=over
=item L<Compress::Zlib>
=item L<JavaScript::Minifier>
=item L<CSS::Minifier>
=back
=head1 AUTHORS
=item Trevor Hall, E<lt>wazzuteke@cpan.orgE<gt>
Original author and maintainer.
=item Romuald Brunet
Generously submitted a patch adopting HTTP::Date to support
POSIX locales and standard international date formats; particularly
useful for file-modification based caching.
=item Stephen Howard (L<http://search.cpan.org/~howars/>)
Submitted concept and patches for file/dir name substituion.
=head1 COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
( run in 1.035 second using v1.01-cache-2.11-cpan-22024b96cdf )