--- loncom/build/lpml_parse.pl 2002/02/05 01:28:57 1.40 +++ loncom/build/lpml_parse.pl 2002/04/08 12:51:03 1.44 @@ -1,11 +1,16 @@ #!/usr/bin/perl +# -------------------------------------------------------- Documentation notice +# Run "perldoc ./lpml_parse.pl" in order to best view the software +# documentation internalized in this program. + +# --------------------------------------------------------- License Information # The LearningOnline Network with CAPA # lpml_parse.pl - Linux Packaging Markup Language parser # -# $Id: lpml_parse.pl,v 1.40 2002/02/05 01:28:57 harris41 Exp $ +# $Id: lpml_parse.pl,v 1.44 2002/04/08 12:51:03 harris41 Exp $ # -# Written by Scott Harrison, harris41@msu.edu +# Written by Scott Harrison, codeharrison@yahoo.com # # Copyright Michigan State University Board of Trustees # @@ -37,7 +42,7 @@ # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison # 12/2,12/3,12/4,12/5,12/6,12/13,12/19,12/29 - Scott Harrison # YEAR=2002 -# 1/8,1/9 - Scott Harrison +# 1/8,1/9,1/29,1/31,2/5,3/21,4/8 - Scott Harrison # ### @@ -58,7 +63,8 @@ # # I am using a multiple pass-through approach to parsing # the lpml file. This saves memory and makes sure the server -# will never be overloaded. +# will never be overloaded. At some point, I expect the +# first two steps will be implemented with my XFML # # This is meant to parse files meeting the lpml document type. # See lpml.dtd. LPML=Linux Packaging Markup Language. @@ -84,7 +90,7 @@ END # ------------------------------------------------- Grab command line arguments -my $mode; +my $mode=''; if (@ARGV==5) { $mode = shift @ARGV; } @@ -95,20 +101,20 @@ else { exit -1; # exit with error status } -my $categorytype; +my $categorytype=''; if (@ARGV) { $categorytype = shift @ARGV; } -my $dist; +my $dist=''; if (@ARGV) { $dist = shift @ARGV; } -my $targetroot; -my $sourceroot; -my $targetrootarg; -my $sourcerootarg; +my $targetroot=''; +my $sourceroot=''; +my $targetrootarg=''; +my $sourcerootarg=''; if (@ARGV) { $sourceroot = shift @ARGV; } @@ -138,7 +144,7 @@ END # ---------------------------------------------------- Start first pass through my @parsecontents = <>; my $parsestring = join('',@parsecontents); -my $outstring; +my $outstring=''; # Need to make a pass through and figure out what defaults are # overrided. Top-down overriding strategy (leaves don't know @@ -152,7 +158,7 @@ $parser = HTML::TokeParser->new(\$parses die('can\'t create TokeParser object'); $parser->xml_mode('1'); my %hash; -my $key; +my $key=''; while ($token = $parser->get_token()) { if ($token->[0] eq 'S') { $hloc++; @@ -173,9 +179,9 @@ while ($token = $parser->get_token()) { } # --------------------------------------------------- Start second pass through -undef $hloc; -undef @hierarchy; -undef $parser; +undef($hloc); +undef(@hierarchy); +undef($parser); $hierarchy[0]=0; $parser = HTML::TokeParser->new(\$parsestring) or die('can\'t create TokeParser object'); @@ -949,7 +955,9 @@ sub format_directory { my ($chmod,$chown)=split(/\s/,$categoryhash{$categoryname}); return $directory="\n