Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

geoff (2013)

geoff
  reversethis-{gro ... om} {ta} {ffoeg}
http://www.modperlcookbook.org/

see http://www.modperlcookbook.org/~geoff/ [modperlcookbook.org] for personal information, links to presentations, GPG key, and so on.

Journal of geoff (2013)

Monday November 29, 2004
11:23 AM

mod_images_never_expire

[ #22049 ]
one of the most interesting talks I heard at ApacheCon was Michael Radwin's HTTP Caching and Cache-busting for Content Publishers. In that talk he presented an (ingeniously simple) Apache C extension module called mod_images_never_expire.c.

I took that module, added some basic tests, and wrapped it up in an Apache-Test-based tarball, mod_images_never_expire-example.tar.gz .

in the below output, notice how mod_images_never_expire.c is compile and tested in a single command, all without invoking perl explicitly. make would simply compile the module, and sudo make install would install and activate the module for the specified Apache.

$ tar zxvf mod_images_never_expire-example.tar.gz
$ cd mod_images_never_expire-example/

$ export APACHE_TEST_APXS=/usr/local/apache/bin/apxs
$ make test
perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for mod_images_never_expire
make[1]: Entering directory `/src/mod_images_never_expire-example'
make[1]: Nothing to be done for `makefile'.
make[1]: Leaving directory `/src/mod_images_never_expire-example'
make[1]: Entering directory `/src/mod_images_never_expire-example'
/perl/perl-5.8.5/bin/perl -Iblib/arch -Iblib/lib \
t/TEST  -clean
APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= APACHE_TEST_APXS=/usr/local/apache/bin/apxs \
/perl/perl-5.8.5/bin/perl -Iblib/arch -Iblib/lib \
t/TEST  -bugreport -verbose=0
make[2]: Entering directory `/src/mod_images_never_expire-example/c-modules'
cd images_never_expire && make mod_images_never_expire.so
make[3]: Entering directory `/src/mod_images_never_expire-example/c-modules/images_never_expire'
/usr/local /apache/bin/apxs -D APACHE1 -I/src/mod_images_never_expire-example/c-modules -c mod_images_never_expire.c
gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DUSE_HSREGEX -fpic -DSHARED_MODULE -I/usr/local/apache/include -I/src/mod_images_never_expire-example/c-modules -DAPACHE1  -c mod_images_never_expire.c
gcc -shared -o mod_images_never_expire.so mod_images_never_expire.o
make[3]: Leaving directory `/src/mod_images_never_expire-example/c-modules/images_never_expire'
make[2]: Leaving directory `/src/mod_images_never_expire-example/c-modules'
/usr/local/apache/bin/httpd  -d /src/mod_images_never_expire-example/t -f /src/mod_images_never_expire-example/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS
using Apache/1.3.32

waiting 60 seconds for server to start: ...
waiting 60 seconds for server to start: ok (waited 2 secs)
server localhost.localdomain:8529 started
t/01image.......ok
t/02nonimage....ok
All tests successful.
Files=2, Tests=24,  1 wallclock secs ( 1.35 cusr +  0.07 csys =  1.42 CPU)
[warning] server localhost.localdomain:8529 shutdown
make[1]: Leaving directory `/src/mod_images_never_expire-example'

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Sadly, the makefile trickery doesn't work in case-insensitive filesystems. :-(
    • like OSX? if you're using GNU make you can probably move makefile to GNUmakefile and get the same effect.

      but yeah, using both files is a hack, as is the force trickery to pass unknown commands down to the perl-generated Makefile. but the idea here is to hide perl from the process as much as possible - there is no reason why you can't use Makefile.PL for everything, it's just more complex.