#!/usr/bin/perl use strict; use warnings FATAL => qw( all ); use CGI::Carp qw(fatalsToBrowser); use lib '../files/perl/lib'; use Base::HTML qw(print_story); print_story(*DATA,1); __DATA__ This is the first paragraph in the story. This is the last paragraph in the story. #### #!/usr/bin/perl use strict; use warnings FATAL => qw( all ); use CGI::Carp qw(fatalsToBrowser); use lib '../files/perl/lib'; use Base::HTML qw(print_story); print_story(*DATA,1); __DATA__ Paragraph that opens the document. 2 Heading for definition list This is the paragraph that precedes the definition list. #This is the line where the definition list should be inserted. This is the paragraph that follows the definition list. 2 Heading for next definition list This is the paragraph that precedes the next definition list. #This is the line where the next definition list should be inserted. This is the paragraph that follows the next definition list. 2 Heading for the close of the document The paragraph that closes the document. #### sub print_story { my ($source,$html) = @_; my $tab = $html ? 3 : 4; start_html() if $html; while (my $line = <$source>) { chomp($line); if ($line =~ m/^$text)); } else { line($tab,qq(

$line

)); } } line($tab,qq(

written by $user

)) if $tab == 3; end_html if $html; } sub print_definitions { my (%opt) = @_; my $tab = exists($opt{html}) ? 3 : 4; my %definition_list; get_hash( hash => \%definition_list, file => exists($opt{file}) ? $opt{file} : get_data, headings => [@{$opt{headings}}], sort => 'yes', ); start_html() if exists($opt{html}); unless (exists($opt{html}) || exists($opt{heading})) { line(3,qq(

$heading definitions

)); } line($tab,q(
)); my $term = shift @{$opt{headings}}; for my $term (sort {$definition_list{$a}{sort_number} <=> $definition_list{$b}{sort_number}} keys %definition_list) { line($tab + 1,qq(
$term
)); if (scalar @{$opt{headings}} == 1) { line($tab + 2,qq(
$definition_list{$term}{$opt{headings}->[0]})); } else { for my $heading (@{$opt{headings}}) { my $upheading = ucfirst $heading; line($tab + 2,qq{
$upheading: }.encode_entities($definition_list{$term}{$heading}).qq{
}); } } } line($tab,q(
)); end_html if exists($opt{html}); }