Diff for /loncom/build/lpml_parse.pl between versions 1.41 and 1.44

version 1.41, 2002/03/22 01:55:04 version 1.44, 2002/04/08 12:51:03
Line 1 Line 1
 #!/usr/bin/perl  #!/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  # The LearningOnline Network with CAPA
 # lpml_parse.pl - Linux Packaging Markup Language parser  # lpml_parse.pl - Linux Packaging Markup Language parser
 #  #
 # $Id$  # $Id$
 #  #
 # Written by Scott Harrison, harris41@msu.edu  # Written by Scott Harrison, codeharrison@yahoo.com
 #  #
 # Copyright Michigan State University Board of Trustees  # Copyright Michigan State University Board of Trustees
 #  #
Line 37 Line 42
 # 11/4,11/5,11/6,11/7,11/16,11/17 - Scott Harrison  # 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  # 12/2,12/3,12/4,12/5,12/6,12/13,12/19,12/29 - Scott Harrison
 # YEAR=2002  # YEAR=2002
 # 1/8,1/9,1/29,1/31,2/5,3/21 - Scott Harrison  # 1/8,1/9,1/29,1/31,2/5,3/21,4/8 - Scott Harrison
   #
 ###  ###
   
 ###############################################################################  ###############################################################################
Line 57 Line 63
 #  #
 # I am using a multiple pass-through approach to parsing  # I am using a multiple pass-through approach to parsing
 # the lpml file.  This saves memory and makes sure the server  # 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.  # This is meant to parse files meeting the lpml document type.
 # See lpml.dtd.  LPML=Linux Packaging Markup Language.  # See lpml.dtd.  LPML=Linux Packaging Markup Language.
Line 83  END Line 90  END
   
 # ------------------------------------------------- Grab command line arguments  # ------------------------------------------------- Grab command line arguments
   
 my $mode;  my $mode='';
 if (@ARGV==5) {  if (@ARGV==5) {
     $mode = shift @ARGV;      $mode = shift @ARGV;
 }  }
Line 94  else { Line 101  else {
     exit -1; # exit with error status      exit -1; # exit with error status
 }  }
   
 my $categorytype;  my $categorytype='';
 if (@ARGV) {  if (@ARGV) {
     $categorytype = shift @ARGV;      $categorytype = shift @ARGV;
 }  }
   
 my $dist;  my $dist='';
 if (@ARGV) {  if (@ARGV) {
     $dist = shift @ARGV;      $dist = shift @ARGV;
 }  }
   
 my $targetroot;  my $targetroot='';
 my $sourceroot;  my $sourceroot='';
 my $targetrootarg;  my $targetrootarg='';
 my $sourcerootarg;  my $sourcerootarg='';
 if (@ARGV) {  if (@ARGV) {
     $sourceroot = shift @ARGV;      $sourceroot = shift @ARGV;
 }  }
Line 137  END Line 144  END
 # ---------------------------------------------------- Start first pass through  # ---------------------------------------------------- Start first pass through
 my @parsecontents = <>;  my @parsecontents = <>;
 my $parsestring = join('',@parsecontents);  my $parsestring = join('',@parsecontents);
 my $outstring;  my $outstring='';
   
 # Need to make a pass through and figure out what defaults are  # Need to make a pass through and figure out what defaults are
 # overrided.  Top-down overriding strategy (leaves don't know  # overrided.  Top-down overriding strategy (leaves don't know
Line 151  $parser = HTML::TokeParser->new(\$parses Line 158  $parser = HTML::TokeParser->new(\$parses
     die('can\'t create TokeParser object');      die('can\'t create TokeParser object');
 $parser->xml_mode('1');  $parser->xml_mode('1');
 my %hash;  my %hash;
 my $key;  my $key='';
 while ($token = $parser->get_token()) {  while ($token = $parser->get_token()) {
     if ($token->[0] eq 'S') {      if ($token->[0] eq 'S') {
  $hloc++;   $hloc++;
Line 172  while ($token = $parser->get_token()) { Line 179  while ($token = $parser->get_token()) {
 }  }
   
 # --------------------------------------------------- Start second pass through  # --------------------------------------------------- Start second pass through
 undef $hloc;  undef($hloc);
 undef @hierarchy;  undef(@hierarchy);
 undef $parser;  undef($parser);
 $hierarchy[0]=0;  $hierarchy[0]=0;
 $parser = HTML::TokeParser->new(\$parsestring) or  $parser = HTML::TokeParser->new(\$parsestring) or
     die('can\'t create TokeParser object');      die('can\'t create TokeParser object');
Line 1455  sub format_build { Line 1462  sub format_build {
     if ($text) {      if ($text) {
  $parser->get_tag('/build');   $parser->get_tag('/build');
  $build=$sourceroot.'/'.$text.';'.$tokeninfo[2]{'trigger'};   $build=$sourceroot.'/'.$text.';'.$tokeninfo[2]{'trigger'};
  $build=~s/[^\\]\\\s+//g; # allow for having lines split onto new lines   $build=~s/([^\\])\\\s+/$1/g; # allow for lines split onto new lines
     }      }
     return '';      return '';
 }  }
Line 1548  sub trim { Line 1555  sub trim {
   
 # ----------------------------------- POD (plain old documentation, CPAN style)  # ----------------------------------- POD (plain old documentation, CPAN style)
   
   =pod
   
 =head1 NAME  =head1 NAME
   
 lpml_parse.pl - This is meant to parse files meeting the lpml document type.  lpml_parse.pl - This is meant to parse LPML files (Linux Packaging Markup Language)
 See lpml.dtd.  LPML=Linux Packaging Markup Language.  
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
Line 1615  linux Line 1623  linux
   
 Packaging/Administrative  Packaging/Administrative
   
   =head1 AUTHOR
   
    Scott Harrison
    codeharrison@yahoo.com
   
   Please let me know how/if you are finding this script useful and
   any/all suggestions.  -Scott
   
 =cut  =cut

Removed from v.1.41  
changed lines
  Added in v.1.44


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>