# $File: //depot/OurNet-Query/WebBuilder.pm $ $Author: autrijus $ # $Revision: #1 $ $Change: 1139 $ $DateTime: 2001/06/14 18:46:33 $ package OurNet::WebBuilder; require 5.005; $OurNet::WebBuilder::VERSION = '1.21'; use strict; use CGI; use CGI::Cookie; =head1 NAME OurNet::WebBuilder - Web rendering for BBS-based services =head1 SYNOPSIS use OurNet::WebBuilder; my $tmpl = { dir => \%dir, article => \%article, cgi_url => CGI->url }; my $opref = { '' => sub { return '!view'; }, 'view' => sub { $tmpl->{'menu'} ||= param('curdir') || $dir{'oin'}[0]{id}; $tmpl->{'curdir'} ||= param('curdir') || $dir{'oin'}[0]{id}; loadboard($tmpl->{'curdir'}); loadarticle( $_->{'id'}, ($tmpl->{'curdir'} eq 'bbs' ? $bbs : ($oin, $tmpl->{'curdir'}))) foreach @{$dir{$tmpl->{'curdir'}}}; return 'view'; } }; OurNet::WebBuilder::Display($tmpl, $opref); =head1 DESCRIPTION the method C takes $tmpl, which is a variable pool, and $opref, which is hash of mapping from 'op' to the subroutine for that 'op'. The op routine fill in the $tmpl with the varialbes it would like the variable pool to have, and returns the name of the template file that would be used. or if the return value begins with '!', the variable pool will be transit to the specified op again. You may set I<$OurNet::WebBuilder::Backend> to specify a specific rendering package. Currently, I, I