Warning: problems with command line tool if ActivePerl installed

Started by Archive, May 12, 2010, 08:54:00 AM

Previous topic - Next topic

Archive

[Originally posted by keesmoerman on 2007-01-22 18:10:08-08]

I recently found out about this excellent utility.

I tried the command-line utility, but because I already had ActiveState Perl installed, I got a problem which also might hit other novice users (maybe something for the FAQ): I had the PERL5OPT environment variable set to have some options I often use active, and the ExifTool command line utility also responds to this setting, however was not able to handle them (due to different paths in @INC):

Code:
C:\Users\Kees>exiftool
Can't locate File/DosGlob.pm in @INC (@INC contains: C:/Perl/Progs/Modules .) at C:/Perl/Progs/Modules/G.pm line 1.
BEGIN failed--compilation aborted at C:/Perl/Progs/Modules/G.pm line 1.
Compilation failed in require.
BEGIN failed--compilation aborted.

Solution is simple: clear (e.g. manually or in same batch file as using your ExifTool command) PERL5OPT with SET PERL5OPT=

But of course, would be nice if this would not happen (esp for non Perl experienced people who have Perl installed due to eg office configuration).

Archive

[Originally posted by exiftool on 2007-01-22 18:28:45-08]

Thanks for this report.

I'll have to read up on PERL5OPT.  I must say, I don't understand
what is going on when you get this problem.  Does it also occur
when you run exiftool with parameters (ie. "exiftool -ver"), or
just as a bare command.  If it only happens without arguments,
then it is a problem running perldoc to print the documentation,
and I should be able to fix this.

Archive

[Originally posted by keesmoerman on 2007-01-23 08:14:19-08]

Yes, it also happens with parameters. I am not an expert here but this is my explanation:

PERL5OPT is an (ActiveState specific?) environment variable. You can find more info in the ActiveState perlrun.html page, from which this quote:

PERL5OPT: Command-line options (switches). Switches in this variable are taken as if they were on every Perl command line. Only the -[DIMUdmtw] switches are allowed. When running taint checks (because the program was running setuid or setgid, or the -T switch was used), this variable is ignored. If PERL5OPT begins with -T, tainting will be enabled, and any subsequent options ignored.

I suspect your command line utility wraps an ActiveState Perl kernel, which as such looks at this environment variable, however does not set @INC in the 'normal' fashion. As a result, the path to the installed ActiveState modules/libraries can not be found. If I start ActiveState normally (without any PERL5OPT setting), @INC contains: "C:/Perl/lib, C:/Perl/site/lib, .", i.e. the path to the standard and site-specific modules. If I look at the error message of ExifTool, here @INC contains only the current directory ".", and thus can not find any modules specified with PERL5OPT=-Gxxxxx.

Regards, Kees.

Archive

[Originally posted by exiftool on 2007-01-25 18:34:46-08]

Thanks for the explanation.  I understand now.  Yes, the stand-alone
version is packaged with ActivePerl, so uses the same environment
variables.  And you are right, it likely modifies the @INC heavily to find
the packaged modules, and this may conflict with existing PERL5OPT
options as you have found.

Hopefully this won't affect many people, and if it does hopefully they
will find this thread as a reference.  I'll add it to the documentation
if anyone else has this problem, but otherwise I prefer to keep the
documentation as short as possible (it is already too long for most
people to read... Tongue ).

- Phil