Perl can't find my libraries when run via the subversion post-commit script
From: Craig Thayer <CThayer_at_sensorlogic.com>
Date: Wed, 3 Mar 2010 14:15:37 -0600
I am at a loss as to why my perl script cannot find my libraries when invoked by the subversion post-commit script. My script runs just fine when invoked manually in a terminal window. I'm aware that the subversion post-commit script runs with no environment defined, but the error I'm getting (below) makes no sense since the module perl claims it can't find (Log.pm) is, in fact, in the '/root/perl5/lib' directory which is clearly listed in the @INC array.
The problem is most likely a perl issue, but since the problem only occurs when my script is run via the subversion post-commit operation I'm hoping that someone else has run into this issue with subversion hooks executing a perl script and can enlighten me as to what I'm missing here. It acts like perl is compiling the 'use' statements BEFORE it compiles the BEGIN section-which comes first.
Here is the error reported by the commit operation when it runs the post-commit script (which calls my svn-post-commit.pl script):
My script adds the path '/root/perl5/lib' to the @INC array in the BEGIN section and my 'use Log' statement is in the main body after the BEGIN section. I've tried several different methods for trying to get perl to find my libraries to no avail (including exporting the PERL5LIB EV in the post-commit script before calling my script and using the 'require' function-but this creates a whole new set of problems with libraries included by the libraries and I don't want to have to hard code paths to libraries in all my modules). And I don't want to place our libraries in one of the perl library paths-which perl seems to have no trouble finding libraries installed with it package (e.g., File::Basename, Net::SMTP, etc.).
post-commit script called by subversion commit:
Snippet of my svn-post-commit.pl perl script called via the post-commit script:
Any help would be greatly appreciated!
This is an archived mail posted to the Subversion Users mailing list.