modperl bootstrap
[www.jankratochvil.net.git] / project / Index.html.pl
similarity index 87%
rename from project/list.cgi.pl
rename to project/Index.html.pl
index eeadeef..2e42b10 100755 (executable)
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
+package project::Index;
 require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
-use vars qw($VERSION $CVS_ID);
-$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
-$CVS_ID=q$Id$;
+our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+our $CVS_ID=q$Id$;
 use strict;
 use warnings;
 
-use lib qw(/home/short/lib/perl5/site_perl/5.6.0/i386-linux /home/short/lib/perl5/site_perl/5.6.0 /home/short/lib/perl5/site_perl/i386-linux /home/short/lib/perl5/site_perl /home/short/lib/perl5/5.6.0/i386-linux /home/short/lib/perl5/5.6.0 /home/short/lib/perl5/i386-linux /home/short/lib/perl5);
-
-use lib "../";
+BEGIN{ open F,"Makefile"; our $top_dir=pop @{[split /\s/,(grep /^top_srcdir/,<F>)[0]]}; eval "use lib '$top_dir'"; close F; }
 use My::Web;
-require CGI;
+require 'CGI';
+require 'My::Project';
 
 use constant ENTRIES=>"CVS/Entries";
 use constant ENTRIES_LOG=>"CVS/Entries.Log";
 
 
 My::Web->init(
+               "__PACKAGE__"=>__PACKAGE__,
                "title"=>'Project List',
                );
 My::Web->heading();
@@ -45,7 +45,7 @@ my $CGI=CGI->new();
 print <<'HERE';
 <h1>Project List of <a href="mailto:web-www.jankratochvil.net@jankratochvil.net">Jan Kratochvil</a></h1>
 
-<form action="list.cgi.pl" method="get"><p>
+<form action="Index.pl" method="get"><p>
 <select name="description_opt" onchange="this.form.submit();">
 HERE
 print '<option value="0"'.(!$CGI->param("description_opt") ? ' selected="selected"' : '').'>only list</option>'."\n";
@@ -72,10 +72,10 @@ for my $ENTRIES (ENTRIES,ENTRIES_LOG) {
 
 my %item;
 for my $dir (keys(%dirs)) {
-       require "$dir/ListItem.pm";
-       my $item=eval('\%My::Project::'.$dir.'::ListItem');
-       do { warn "Broken $dir/List.pm"; next; } if !defined %$item;
-       $item{$dir}=$item;
+       require "project::${dir}::ListItem";
+       my $item=eval('\@project::'.$dir.'::ListItem::ListItem');
+       do { warn "Broken project/$dir/ListItem.pm"; next; } if !defined $item;
+       $item{$dir}={ My::Project::project_arr_to_hash(@$item) };
        }
 
 # $col{"name"}{"show"}=1