[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Pre-commit hook to verify Perl syntax

From: allan <allan_at_muly.dk>
Date: 2006-09-15 09:57:15 CEST

Marcos Chaves wrote:
> Hi. I couldn't find this in the archives.
>
> I'm trying to create a pre-commit hook that only allows the commit of
> Perl codes that pass the "perl -c" check. I have a initial version
> (see below) that does exactly what I want IF the Perl code does not
> use any customized module (.pm), because Perl can't find it when run
> from the hook script.
>
> Does anybody know how this could be done? I'm afraid that the hook
> script would need to perform more tasks, like checking out the current
> version of the path where the modules are located and then trying to
> run "perl -c". Any ideas?
>
> Thanks in advance,
>
> -Marcos

we do it in a post-commit.
basically it first checks the paths being comitted and if meeting the
criteria for doing a compile check at all, it will export the files from
a logic directory base (see example below).
so if you were commiting perlproject1/folder1/file1.pl, then the hook
would export everything below perlproject1 and then run "perl -c
perlproject1/main.pl"

perlproject1/main.pl
perlproject1/folder1/file1.pl
perlproject1/folder1/file2.pl
perlproject1/folder1/file1.pm
perlproject2/folder1/file1.pl

hth
./allan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Sep 15 09:57:56 2006

This is an archived mail posted to the Subversion Users mailing list.