4

I'm working on a large Perl application which gets bundled with PAR, along with a bunch of support files.

When the app is running within PAR, I can use PAR::read_file to get at these various files inside the archive. However, while I'm developing, I don't want to have to re-PAR the whole application every time I tweak some code.

Is there a way that I can tell if the script is running within PAR or not at runtime, so I can choose to load the file from the PAR archive or the regular filesystem?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
friedo
  • 65,762
  • 16
  • 114
  • 184

1 Answers1

8

PAR::Environment can probably offer some clues:

PAR uses various environment variables both during the building process of executables or PAR archives and the use of them.

...

PAR_0

If the running program is run from within a PAR archive or pp-produced executable, this variable contains the name of the extracted program (i.e. .pl file).

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 1
    @tsee Thank you very much for verifying and thank very much for PAR and pp. They have been a great help to me ever since I started using them. – Sinan Ünür Nov 21 '09 at 13:44