The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Website - Perl extension for as engine to render template-driven applications, designed to run quickly in CGI and mod_perl environments

SYNOPSIS

  use Website;

  my $Website = Website->new( file => 'website-tpl.htm' );

  $Website->let('firstname', 'Reto');
  $Website->let('lastname' , 'Hersiczky');
  $Website->block('demoBlock', print => $ENV{QUERY_STRING} eq 'block=1' ? 1 : 0);

  $Website->print(
	contentType_is_set => 0 ,
	quiet              => 1
  );

  [or]
  my $Website = Website->new(
        file   => 'test.htm',
        tuning => [qw( output speed pretty cache compress )] ,
        debug  => 1
  );


  # ----------------------------------------------
  # -- Extended filling into iterative table rows:
  # ----------------------------------------------

  # Populate three records
	my @table_data = (
		"John	Doe	Washington"	,
		"Foo	Bar	Neverland"	,
		"Tiger	Woods	Florida"	,
		"Stars	Stripes	Bruetten"	,
	);

	my $Website = Website->new(
		file => '/usr/lib/perl5/site_perl/ModPerl/website-tpl.htm' );

	$Website->let('firstname', $q->{'firstname'} );
	$Website->let('lastname' , $q->{'lastname' } );
	$Website->block('demoBlock', print => $q->{'block'} == 1 ? 1 : 0);

	my $i = 0;
	my @rowcolors = ('#e0e0e0', 'white');

	foreach (@table_data) {
		my ($firstname, $lastname, $place) = split /\t/;

		$Website->let('bcol', $rowcolors[$i++ % 2], 'tableRow');

		# -- Assign values to data cells (one table row)
		$Website->let('firstname', $firstname, 'tableRow');
		$Website->let('lastname',  $lastname , 'tableRow');
		$Website->let('place'   ,  $place    , 'tableRow');
	}


	$Website->print( contentType_is_set => 1, quiet => 1 );

DESCRIPTION

Documentation for Website, please visit http://www.infocopter.com/perl/website-pm.htm

EXPORT

None by default.

AUTHOR

Reto Hersiczky, <retoh@dplanet.ch>

SEE ALSO

perl.