X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FApp%2FRgit%2FRepository.pm;h=9894a50579409778702c7e97bfdc93de74112dda;hb=df425e04a0fe374b7e1906e417f8238af257742f;hp=a9215764fe68702825c5fa4e50f3013c4f49f6fa;hpb=20ecc90aa6c17a07fd1200d0bf72d5918e53e106;p=perl%2Fmodules%2Frgit.git diff --git a/lib/App/Rgit/Repository.pm b/lib/App/Rgit/Repository.pm index a921576..9894a50 100644 --- a/lib/App/Rgit/Repository.pm +++ b/lib/App/Rgit/Repository.pm @@ -5,13 +5,19 @@ use warnings; use Cwd (); # cwd, abs_path use File::Spec (); # canonpath, catdir, splitdir, abs2rel -use POSIX qw/WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG SIGINT SIGQUIT/; +use POSIX (); # WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG SIGINT SIGQUIT + +my ($WIFEXITED, $WEXITSTATUS, $WIFSIGNALED, $WTERMSIG); BEGIN { - no warnings 'redefine'; - *WIFEXITED = sub { 1 } unless eval { WIFEXITED(0); 1 }; - *WEXITSTATUS = sub { shift() >> 8 } unless eval { WEXITSTATUS(0); 1 }; - *WIFSIGNALED = sub { shift() & 127 } unless eval { WIFSIGNALED(0); 1 }; + $WIFEXITED = eval { POSIX::WIFEXITED(0); 1 } ? \&POSIX::WIFEXITED + : sub { 1 }; + $WEXITSTATUS = eval { POSIX::WEXITSTATUS(0); 1 } ? \&POSIX::WEXITSTATUS + : sub { shift() >> 8 }; + $WIFSIGNALED = eval { POSIX::WIFSIGNALED(0); 1 } ? \&POSIX::WIFSIGNALED + : sub { shift() & 127 }; + $WTERMSIG = eval { POSIX::WTERMSIG(0); 1 } ? \&POSIX::WTERMSIG + : sub { shift() & 127 }; } =head1 NAME @@ -168,12 +174,12 @@ sub run { } my $ret; - $ret = WEXITSTATUS($?) if WIFEXITED($?); + $ret = $WEXITSTATUS->($?) if $WIFEXITED->($?); my $sig; - if (WIFSIGNALED($?)) { - $sig = WTERMSIG($?); + if ($WIFSIGNALED->($?)) { + $sig = $WTERMSIG->($?); $conf->warn("git died with signal $sig\n"); - if ($sig == SIGINT || $sig == SIGQUIT) { + if ($sig == POSIX::SIGINT() || $sig == POSIX::SIGQUIT()) { $conf->err("Aborting\n"); exit $sig; } @@ -214,7 +220,8 @@ You can contact me by mail or on C (vincent). =head1 BUGS -Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. +Please report any bugs or feature requests to C, or through the web interface at L. +I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT