From e7aa5da6bf4c17359c3be215c2216a177e8feb10 Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Fri, 19 Jan 2018 16:45:40 +0100
Subject: [PATCH] small POD section; renamed conversion subroutine: conversion
 from latex to PDF, not the other way

---
 lc1.pl | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/lc1.pl b/lc1.pl
index 190562a..2e567aa 100755
--- a/lc1.pl
+++ b/lc1.pl
@@ -1,5 +1,21 @@
 #!/usr/bin/perl
 
+=head1 NAME
+
+  lc1.pl
+
+=head1 USAGE
+
+  ./lc1.pl &
+
+=head1 DESCRIPTION
+
+Upon start, searches for old LaTeX to PDF conversion jobs and perfoms
+them.  Then the script monitors the current directory for new conversion
+jobs and executes them.
+
+=cut
+
 use strict;
 
 use Filesys::Notify::Simple;
@@ -30,7 +46,7 @@ sub watch
             {
               my ($job, $tex_file)= ($1, $2);
               print __LINE__, " job=[$job] tex_file=[$tex_file]\n";
-              pdf2latex ($job, $tex_file);
+              latex2pdf ($job, $tex_file);
             }
             elsif ($path =~ m#/var/www/html/dlbt/DLBTUploads/TeiConverter/lc1.pl$#)
             {
@@ -73,12 +89,12 @@ sub check_old_jobs
     else
     {
       # print __LINE__, " job=[$job] tex_file=[$tex_file]\n";
-      pdf2latex ($job, $tex_file);
+      latex2pdf ($job, $tex_file);
     }
   }
 }
 
-sub pdf2latex
+sub latex2pdf
 {
   my $jobname= shift;
   my $tex_file= shift;
@@ -111,7 +127,7 @@ sub pdf2latex
   }
 
   print "converting: [", join (' ', @convert), "]\n";
-  sleep (5);
+  sleep (5); # wait some time to avoid possible race conditions
   system (@convert);
 
   if (-d $media_dir)
@@ -120,3 +136,10 @@ sub pdf2latex
     unlink ('media')
   }
 }
+
+__END__
+
+=head1 AUTHOR
+
+  Gerhard Gonter <ggonter@cpan.org>
+
-- 
GitLab