#!/usr/bin/perl # Automatic POD-making requires that :-( package ServDocOutput; #----------------------------------------------------------------------
ServDocOutput - common procs for ServDoc-Output-Modules
$Id: ServDocOutput.pm,v 1.1 2004/01/03 20:43:26 uherbst Exp $
use ServDocOutput;
my ($short_desc,$long_desc,$text,$textref,@headings) = get_and_normalize_SDitem_data($xmltree->{SDitem}->[$i]);
In this perlmodule are common used procedures for more than one output module.
#---------------------------------------------------------------------- require Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use English; use Getopt::Long; # command line options # Data::Dumper is not included in standard perl, # but it is VERY helpful in debugging complex # data structures. BEGIN { $HAS_DATA_DUMPER = 0; eval "use Data::Dumper"; if ( $@ eq "" ) { $HAS_DATA_DUMPER = 1 } } @ISA = qw(Exporter); # Which function are public ? @EXPORT = qw( get_and_normalize_SDitem_data ); # CVS (and RCS) uses a version numbering style, # which isn't compatible with perl's # versioning-style for modules. # This transformation is copied from LWP/Simple.pm $VERSION = sprintf( "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/ ); #----------------------------------------------------------------------
my ($short_desc,$long_desc,$text,$textref,@headings) = get_and_normalize_SDitem_data($xmltree->{SDitem}->[$i]);
Input: a reference to the SDitem structure.
Output: a list with the data:
sub get_and_normalize_SDitem_data { my $itemref = shift; my ($short_desc,$long_desc,$text,$tableref,@headings); $short_desc = $itemref->{short}->[0]->{content}; $long_desc = $itemref->{long}->[0]->{content}; $text = $itemref->{data}->[0]->{content}; $tableref = $itemref->{data}->[0]->{table}; # Get headings if (!defined($itemref->{title}->[0]->{h0})) { die "title format isn't correct"; } my $x="h0"; while ($itemref->{title}->[0]->{$x}->[0]->{content}) { push @headings,$itemref->{title}->[0]->{$x}->[0]->{content}; $x++; # h0->h1, h1->h2,... } # normalize short, long, text return ($short_desc,$long_desc,$text,$tableref,@headings); } #----------------------------------------------------------------------
Ulrich Herbst <ulrich.herbst@gmx.de>
1;