diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2012-04-06 20:29:05 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2012-04-06 21:13:56 +0530 |
commit | d3610191d3b7a21d210f62f3a75b512a350a3214 (patch) | |
tree | a73d2b2d83c5ad64378f03d6f9954a2068735000 /src/lib/Gitolite/Triggers.pm | |
parent | upgrade instructions forgot about the VERSION file update! (diff) | |
download | gitolite-gentoo-d3610191d3b7a21d210f62f3a75b512a350a3214.tar.gz gitolite-gentoo-d3610191d3b7a21d210f62f3a75b512a350a3214.tar.bz2 gitolite-gentoo-d3610191d3b7a21d210f62f3a75b512a350a3214.zip |
supporting DOS and fake Unix...
I was very, very, tempted to say "sorry; not supported". Sadly,
prudence won over juvenile glee...
PS: DOS == dominant operating system
Diffstat (limited to 'src/lib/Gitolite/Triggers.pm')
-rw-r--r-- | src/lib/Gitolite/Triggers.pm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/Gitolite/Triggers.pm b/src/lib/Gitolite/Triggers.pm new file mode 100644 index 0000000..16e8aa6 --- /dev/null +++ b/src/lib/Gitolite/Triggers.pm @@ -0,0 +1,33 @@ +package Gitolite::Triggers; + +# load and run triggered modules +# ---------------------------------------------------------------------- + +#<<< +@EXPORT = qw( +); +#>>> +use Exporter 'import'; + +use Gitolite::Rc; +use Gitolite::Common; + +use strict; +use warnings; + +# ---------------------------------------------------------------------- + +sub run { + my ( $module, $sub, @args ) = @_; + $module = "Gitolite::Triggers::$module" if $module !~ /^Gitolite::/; + + eval "require $module"; + _die "$@" if $@; + my $subref; + eval "\$subref = \\\&$module" . "::" . "$sub"; + _die "module '$module' does not exist or does not have sub '$sub'" unless ref($subref) eq 'CODE'; + + $subref->(@args); +} + +1; |