gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

syntax error at /home/Darrell/bin/githooks.pl line 2, near "/pod/Git::Hooks" #22

Closed raindarr closed 8 years ago

raindarr commented 9 years ago

'Im new at Git and perl.. Trying to get the driver script to work..its coded as documented but I get terror when I run it inside repo $ $HOME/bin/githooks.pl Bareword found where operator expected at /home/Darrell/bin/githooks.pl line 2, near "/pod/Git::Hooks" (Missing operator before ::Hooks?) Unknown regexp modifier "/G" at /home/Darrell/bin/githooks.pl line 2, at end of line Unknown regexp modifier "/t" at /home/Darrell/bin/githooks.pl line 2, at end of line syntax error at /home/Darrell/bin/githooks.pl line 2, near "/pod/Git::Hooks" Execution of /home/Darrell/bin/githooks.pl aborted due to compilation errors.

the perl script is below.. appreciate any help

!/usr/bin/perl

use Git::Hooks (/pod/Git::Hooks); run_hook($0, @ARGV);

raindarr commented 9 years ago

I am trying to exec "checkjira" hook

gnustavo commented 9 years ago

Hi raindarr,

The script should be simply this:

#!/usr/bin/perl
use Git::Hooks;
run_hook($0, @ARGV);

That part inside parenthesis isn't necessary.

raindarr commented 9 years ago

Thank you so much for responding Gustavo.. I did finally figure that out.. I am now faced with "cannot locate Git/Hooks. Pm in @INC".. Is it referring to my $HOME/bin where i have .git-templates/hooks or a system level dir.. I am using CyGwin64. Perl is in /usr/bin.. PERL5LIB point to perl folders...There is git-core in /usr/share... Not sure where the driver script is looking..

Sent from my iPad

On Aug 30, 2015, at 9:12 PM, Gustavo Chaves notifications@github.com wrote:

Hi raindarr,

The script should be simply this:

!/usr/bin/perl

use Git::Hooks; run_hook($0, @ARGV); That part inside parenthesis isn't necessary.

— Reply to this email directly or view it on GitHub.

gnustavo commented 9 years ago

When you "use Git::Hooks" Perl tries to find a file called Git/Hooks.pm below some directory in the @INC variable. The problem is that it isn't finding it.

How did you install Git::Hooks? If you simply cloned the Git repository you can make it work by using the following script:

#!/usr/bin/perl
use lib '/path/to/git-hooks.git/lib';
use Git::Hooks;
run_hook($0, @ARGV);

You have to change that /path/to/git-hooks.git to the path to your clone.

raindarr commented 9 years ago

HI Gus..

I did not clone the repo.. I created repos on cygwin.. I have since discovered that I did not have Hooks.pm in my environments.. I downloaded from Git hib and am trying to find the right location for it.. I placed in /user/lib/perl5/vendor_perl5/5.22 and several of folders defined my error message..I even placed it in the .git of the repo where Im trying execute the "githooks: stilll getting the @INC message

On Sun, Aug 30, 2015 at 11:08 PM, Gustavo Chaves notifications@github.com wrote:

When you "use Git::Hooks" Perl tries to find a file called Git/Hooks.pm below some directory in the @INC https://github.com/INC variable. The problem is that it isn't finding it.

How did you install Git::Hooks? If you simply cloned the Git repository you can make it work by using the following script:

!/usr/bin/perluse lib '/path/to/git-hooks.git/lib';use Git::Hooks;

run_hook($0, @ARGV);

You have to change that /path/to/git-hooks.git to the path to your clone.

— Reply to this email directly or view it on GitHub https://github.com/gnustavo/Git-Hooks/issues/22#issuecomment-136240606.

raindarr commented 9 years ago

Gus..

I had to re-install "Data::Utils.pm" and "Git/Hooks::More.pm " into Cygwin64...

Now when i execute my "GitHooks.pl" driver from my repo...

Subroutine Git::Hooks::APPLYPATCH_MSG redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::PRE_APPLYPATCH redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::POST_APPLYPATCH redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::PRE_COMMIT redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::PREPARE_COMMIT_MSG redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::COMMIT_MSG redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::POST_COMMIT redefined at /usr/lib/perl5/site_perl/5.22/Git/Hooks.pm line 36. Subroutine Git::Hooks::PRE_REBASE redefined at /usr/lib/perl5/site_perl/5.22/

On Mon, Aug 31, 2015 at 12:44 PM, darrell rainey rain1600@gmail.com wrote:

HI Gus..

I did not clone the repo.. I created repos on cygwin.. I have since discovered that I did not have Hooks.pm in my environments.. I downloaded from Git hib and am trying to find the right location for it.. I placed in /user/lib/perl5/vendor_perl5/5.22 and several of folders defined my error message..I even placed it in the .git of the repo where Im trying execute the "githooks: stilll getting the @INC message

On Sun, Aug 30, 2015 at 11:08 PM, Gustavo Chaves <notifications@github.com

wrote:

When you "use Git::Hooks" Perl tries to find a file called Git/Hooks.pm below some directory in the @INC https://github.com/INC variable. The problem is that it isn't finding it.

How did you install Git::Hooks? If you simply cloned the Git repository you can make it work by using the following script:

!/usr/bin/perluse lib '/path/to/git-hooks.git/lib';use Git::Hooks;

run_hook($0, @ARGV);

You have to change that /path/to/git-hooks.git to the path to your clone.

— Reply to this email directly or view it on GitHub https://github.com/gnustavo/Git-Hooks/issues/22#issuecomment-136240606.

gnustavo commented 9 years ago

Hmm... weird.

Please, tell me how did you install Git::Hooks and the other Perl modules. Did you use the cpan command line tool?

Also, show me your current hook script.

Also, please, go to your repository, execute "git config -l" and show me the results. (Take care to redact any sensitive information that may be shown before posting them here.)

raindarr commented 9 years ago

Thank you for responding..

I installed Perl via CYGWIN64 set then I have subsequently run CPAN for individual modules, I pulled down Hooks.pm from GitHUBand place in "/usr/lib/Git/Hooks dir.. which executon "githooks.pl requested.. I ran CPAN to get Utils.pm and More.PM.. leading to the "Subroutine redefined hook messages".. Below my githooks.pl and listing from git config-l.. My goal is to simply force developer to include Jira issues upon Git Commits.. For now I want to do this for a single repository to show it works..

!/usr/bin/env perl

use Git::Hooks; run_hook($0, @ARGV); ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "githooks.pl" [dos format] 3 lines, 60 characte

Darrell@raindarr ~/test-repo/test-repo $ git config -l githooks.plugin=CheckJira githooks.plugin=CheckCommit githooks.plugin=CheckLog githooks.admin=rain1600@gmail.com githooks.checkcommit.email=valid = 1 user.email=rain1600@gmail.com user.name=rain1600 init.templatedir=/home/Darrell/.git-templates githooks.checkjira.jiraurl=https://raindarr:8100 githooks.checkjira.jirauser=rain1600@gmail.com githooks.checkjira.jirapass=XXXXX githooks.checkjira.matchlog=(?s)^[([^]]+)] core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true githooks.plugin=checkjira

On Tue, Sep 1, 2015 at 8:35 AM, Gustavo Chaves notifications@github.com wrote:

Hmm... weird.

Please, tell me how did you install Git::Hooks and the other Perl modules. Did you use the cpan command line tool?

Also, show me your current hook script.

Also, please, go to your repository, execute "git config -l" and show me the results. (Take care to redact any sensitive information that may be shown before posting them here.)

— Reply to this email directly or view it on GitHub https://github.com/gnustavo/Git-Hooks/issues/22#issuecomment-136699094.

gnustavo commented 9 years ago

You don't need to install Git::Hooks::More explicitly since it is part of the Git::Hooks distribution.

I don't use Windows or cygwin to check, but you should be able to install Git::Hooks by using the command cpan Git::Hooks or better yet if you have cpanm available: cpanm Git::Hooks. Both commands will fetch dependencies for you.

But now it seems that your library is botched because of those error messages. You have to fix it first. Perhaps the easiest way to do it is to remove and reinstall Perl or Cygwin. I'm sorry.

This configuration is wrong:

githooks.checkcommit.email=valid = 1

It should read like this:

githooks.checkcommit.email-valid=1