#!/usr/bin/perl# ARDF-PGM: massage program data created by FMP4 export# mod from ardf-pgm.v2.pl on /u/cef99/pgmuse Text::Wrapprint "\NASUG'2001 ardf-pgm v1.2\n\n";print "C F Baum  Jan2001\n\n";print "abstract data file : ";chop($infilename=<STDIN>);open(IN,$infilename) || die "Cannot open $infilename for input";open(OUT,'>asug01.rdf') || die "Cannot open asug01.rdf for output";#require 'ctime.pl';$Date= &ctime(time);chop(@strings=<IN>);$lines=0;$down=0;foreach(@strings) {   ($ti,$au,$af,$em,$seqnr,$abst,$sdt,$stm,$sti)=split(/\t/,$_);    (@au)=split(/\x1d/,$au);   (@af)=split(/\x1d/,$af);   (@em)=split(/\x1d/,$em);   $nau=@au;    $naf=@af;   $nem=@em;   print OUT "Template-Type: ReDIF-Paper 1.0\n";   print OUT "Title: $ti\n";   $lines++;   for ($i=1;$i<=$nau;$i++) {	   &ac($au[$i-1]);	   &ac($af[$i-1]);	   print OUT "Author-Name: $au[$i-1]\nAuthor-WorkPlace-Name: $af[$i-1]\nAuthor-Email: $em[$i-1]\n";	   }	&ac($abst);   print OUT "Abstract: ";   print OUT wrap(""," ",$abst);   print OUT "\nSeries: North American Stata Users' Group Meetings, 2001\n";   print OUT "Number: $seqnr\n";   print OUT "Creation-Date: 20010115\n";   if ($url) { #	print "$seqnr $url\n"; 	print OUT "File-URL: $url\n";	ffmt($url);#	print OUT "Handle: RePEc:sce:scecf9:$seqnr"."d\n\n";#	} else {#  	print OUT "Handle: RePEc:sce:scecf9:$seqnr\n\n";	}   	print OUT "Handle: RePEc:boc:asug01:$seqnr\n\n";}close(IN);close(OUT);print "Papers processed: $lines\n";print "Downloadable    : $down\n";exit;sub ac{	$_=@_[0];	s!\x0b! !g;#	s!\x0b! \\& !g;	s/\[/ /g;	s/\]/ /g;	s/Ù/&ccedil;/g;	s/Ú/&eacute;/g;	s/÷/&oacute;/g;	s/¶/&egrave;/g;	s/½/&aacute;/g;	s/À/&oslash;/g;	s/Ã/&agrave;/g;	s/É/&auml;/g;    s/û/&ouml;/g;    s/·/&Ouml;/g;	s/Ä/&uuml;/g;	s/º/&Uuml;/g;	s/Í/'/;g;	s!\xCA! !g;	s/``/"/g;        s/ÍÍ/"/g;	s/''/"/g;	$_[0]=$_;}sub ffmt{	$_=@_[0];        if(s/.+.pdf$/File-Format: application\/pdf\n/i) {goto l};        if(s/.+.ps$/File-Format: application\/postscript\n/i) {goto l};         if(s/.+.html$/File-Format: text\/html\n/i) {goto l};        if(s/.+.htm$/File-Format: text\/html\n/i) {goto l};        if(s/.+zip$/File-Format: application\/bin\/zipped\n/i) {goto l};        if(s/.+ZIP$/File-Format: application\/bin\/zipped\n/i) {goto l};        if(s/.+gz$/File-Format: application\/bin\/gnuzipped\n/i) {goto l};        if(s/.+[a-zA-Z]$/File-Format: text\/plain\n/i) {goto l};        if(s/.+[0-9]$/File-Format: text\/html\n/i) {goto l};        if(s/.+\/$/File-Format: text\/plain\n/i) {goto l};	return;        l:print OUT "$_"."File-Function: main text\n";        $down++;}