8

I want to write an arara rule for perl scripts, especially for fancy-preview. (Another test-script: latexcount.)


Edit:

  1. In the Command-Line perl fancy-preview jobname.tex works!

  2. I have installed ActiveState Perl


This does not work

!config
# perl rule for arara
# version: 0.1
# requires arara 3.0+
identifier: perl
name: Perl
command: <arara> @{program} @{script} @{getBasename(file)} @{options}
arguments:
- identifier: program
  flag: <arara> @{parameters.program}
  default: cmd /c  perl
- identifier: script
  flag: <arara> @{parameters.script}
  default: fancy-preview
- identifier: options
  flag: <arara> @{parameters.options}
  default: --fancy_options="previewall,nosoap"

Error Comment:

Running Perl... 

Can't locate Config/IniFiles.pm in @INC (@INC contains: C:/texlive/2013/tlpkg/tlperl/lib c:/texlive/2013/tlpkg/tlperl/lib .) at fancy-preview line 227.
BEGIN failed--compilation aborted at fancy-preview line 227.
FAILURE
C:\texlive\2013\bin\win32\runscript.tlu:650: command failed with exit code 1:
java.exe -jar c:/texlive/2013/texmf-dist/scripts/arara/arara.jar interaktiv2.tex --verbose --log

What can I do?


EDIT1:

The "rule" above is a first draft-version.

For the result, I thought about an inputpath: 'C:/MyPerlScripts/...' or so on - so I have not to build a coupled motion for my perl-scripts and could store them under a central place. But for this and others, the rule has to run ;) ...


EDIT2:

If I change

 - identifier: program
      flag: <arara> @{parameters.program}
      default: cmd /c start perl

there is no error-messgage but the perls scripts were not runned (ok, this only for Windows, but it does not work) - I do not understand! :(


Edit3:

Same effect as Edit2:

 - identifier: program
      flag: <arara> @{parameters.program}
      default: cmd /c start C:/Perl/bin/perl.exe

Same without 'start':

Running Perl... 

Perl lib version (5.16.2) doesn't match executable 'fancy-preview.pl' version (v5.16.3) at C:/texlive/2013/tlpkg/tlperl/lib/Config.pm line 60.
Compilation failed in require at C:/texlive/2013/tlpkg/tlperl/lib/DynaLoader.pm line 22 ....







A litte message of partially success

I think the problem is partly the script fancy-preview and partly arara.

Because: If I use the script latexcount with "perl.yaml" as given above on the following document

% arara: perl: { script: latexcount.pl }

\documentclass{article}
\begin{document}
Count these words!
\end{document}

I get

Can't open --fancy_options=previewall,nosoap: No such file or directory at latexcount.pl line 72, <> line 8.

3 words in the main text
 in the footnotes
3 total

Status: SUCCESS

This is correct in each line!

I think (at fancy-preview etc.) arara stops, if there is a warning or something else. In that case, I do not know, what to do - this could be arara-interna or not? The authors-team are the last hope :()

9
  • Can you run the perl command you are aiming for from the command line without arara being involved? Because the error looks like perl can't find one of the modules required by fancy-preview and that wouldn't be a problem with the arara rule.
    – cfr
    Jul 4, 2014 at 1:03
  • 1
    The Perl in TeX Live is a rather restricted version only with modules, needed by the TeX Live Manager. Other Perl scripts might need a full Perl with additional modules. Jul 4, 2014 at 1:07
  • Sry, I forgot some informations (see edit). Yes, the classical way works (with "full perl")
    – cis
    Jul 4, 2014 at 1:18
  • 1
    So the full version of perl you have installed is not part of TeX Live, correct? In that case, I'd suggest specifying the full path to the correct perl. I suspect - though I'm not sure - that when arara runs it is picking up a different perl from the version you are getting at the command line. Notice that @INC only includes directories for what I assume is the TeX Live perl. [I do not use Windows so cannot be sure of this. But that's certainly what it looks like.] Also did you install the perl library mentioned in the link you posted (Config::IniFiles)?
    – cfr
    Jul 6, 2014 at 21:59
  • 1
    It shouldn't be using e.g.C:/texlive/2013/tlpkg/tlperl/lib/DynaLoader.pm because that library will match TL's perl not your system perl. That's what the mismatch error is complaining about. It is using the wrong @INC. I don't know what the values should be on Windows but you need to put the relevant directories probably before the TL ones in the equivalent of PATH. On my system, for example, I'd need to put /usr/bin/vendor_perl:/usr/bin/core_perl before /usr/local/texlive/bin if I had perl binaries in TL which I wished to override.
    – cfr
    Jul 10, 2014 at 21:44

1 Answer 1

2

So, I think, thats it:

· identifier program : please choose your own perl version here as default. In the most cases, artless "perl" is written here

· identifier inputfile: choose

% arara: perl: {script: xyz.pl , inputfile: '' }

for an empty value, for example in these cases, when the perl-script is not executed on a tex-file.

· boolean identifier onlylog gives the perl-log as perl_log.txt

% arara: perl: {script: xyz.pl , onlylog: yes }

Check (for Linux) if you need ^> perl_log.txt instead of > perl_log.txt

· identifier inputpath choose the path to the folder, which contains your perl-scripts ;)

· identifiers compile and options:

Example:

% HELP:
% Help-Info "fancy-preview":
% #arara: perl: { script: fancy-preview.pl , options: -h }

% Help-Info "perl":
% #arara: perl: { script: latexcount.pl , compile: -h }

perl.yaml

!config
# perl rule for arara
# version: 0.2a
# requires arara 3.0+, PERL
#
#  ### 
#  Please check defaults at 'program', 'inputpath' (and 'onlylog') !
#  ###
#
identifier: perl
name: Perl
command: <arara> @{program} @{compile} @{inputpath}@{script} @{inputfile} @{options} @{onlylog}
arguments:
- identifier: program
  flag: <arara> @{parameters.program}
  default: 'cmd /c c:\texlive\2013\tlpkg\tlperl\bin\perl.exe'  
#  default: <arara> @{ isWindows("cmd /c  perl", "perl") }
#  default: 'cmd /c  c:\Perl\bin\perl.exe'
- identifier: compile
  flag: <arara> @{parameters.compile}
- identifier: inputpath
  flag: <arara> @{parameters.inputpath}
  default: 'C:\Users\ccc\PerlScripts\'
- identifier: script
  flag: <arara> @{parameters.script}
- identifier: inputfile
  flag: <arara> @{parameters.inputfile}
  default: <arara> @{getBasename(file)}.tex
- identifier: options
  flag: <arara> @{parameters.options}
- identifier: onlylog
  flag: <arara> @{ isTrue( parameters.onlylog , "> perl_log.txt"  ) }

I tested with success: latexcount.pl and fancy-preview.pl (Warning: at fancy-preview.pl you have to do some preliminary work - pm-modules, acrotex-packages).

Example

% arara: perl: { script: latexcount.pl  }

\documentclass{article}
\begin{document}
Count these words, immediately! 
\end{document}

enter image description here

7
  • So that uses Tex Live's perl after all? In that case, it won't work as a general solution for running scripts, right? Even though it works for this particular case?
    – cfr
    Jul 11, 2014 at 18:39
  • I'll try to write an answer today. :) Jul 11, 2014 at 19:06
  • Hi, you two. In >>my<< case, I decided, to use TL-perl. But there is no commitment to this (as I said, choose your own perl as default at the 'program'-identifier). My solution was: I added thoose perl-pm-modules on the path, where the compiler missed them - so it works (especially at fancy-preview) ;)
    – cis
    Jul 11, 2014 at 21:29
  • @cfr: Could you say me please: Does perl.yaml as shown above work on your Linux-system? (By setting your own defaults.)
    – cis
    Jul 23, 2014 at 8:30
  • @cis Well that won't tell you much. I don't have a TeX Live version of perl to override. If you are mixing modules you installed with your system perl with the TL executable then you will run into trouble if one or other gets updated out-of-sync. That is, the fact that it works now is partly luck and I don't think this solution should be regarded as robust.
    – cfr
    Jul 24, 2014 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .