2 # Handle the set of ".pm" files for mod_perl
3 # Copyright (C) 2005 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; exactly version 2 of June 1991 is required
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 package My::ModPerlPm;
20 require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
21 our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
26 use Carp qw(cluck confess);
30 our @ISA=qw(Exporter);
33 # $args{"sub"}=sub { $_[0]->{"module"...}; };
38 my $filename="make -s MODPERL_PM-print|";
40 open F,$filename or confess "$filename: $!";
44 next if !s/^MODPERL_PM:([^:]+)://;
48 $r{"url"}=$subdir."/".$_;
49 $r{"url"}=~s{^[.](/.*[.]pm)$}{$1} or confess "Invalid project: subdir=$subdir base=$_";
50 $r{"module"}=$r{"url"};
51 $r{"module"}=~s{^/}{} or confess "Relative module: ".$r{"module"};
52 $r{"file"}=$r{"module"};
53 $r{"module"}=~s{/}{::}g;
54 $r{"module"}=~s{[.]pm$}{} or confess;
55 -r $r{"file"} or do { warn "FIXME: Non-existing file \"".$r{"file"}."\" for URL: ".$r{"url"}; next; };
56 do { &{$_}(\%r) if $_; } for $args{"sub"};
60 close F or confess "$filename: $!";
61 cluck "No modules?" if !@r;