| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package SVN::Friendly::Utils; | ||
| 5 | my $CLASS = __PACKAGE__; | ||
| 6 | |||
| 7 | #-------------------------------------------------------------------- | ||
| 8 | |||
| 9 | use Exporter; | ||
| 10 | our @ISA = qw(Exporter); | ||
| 11 | our @EXPORT_OK=qw(_shiftBoolean _shiftVisitor); | ||
| 12 | |||
| 13 | #-------------------------------------------------------------------- | ||
| 14 | |||
| 15 | our $NOOP = sub { return 0; }; | ||
| 16 | |||
| 17 | |||
| 18 | #================================================================== | ||
| 19 | # FUNCTIONS - for use internally within SVN::Friendly | ||
| 20 | #================================================================== | ||
| 21 | |||
| 22 | #---------------------------------------------------------------- | ||
| 23 | |||
| 24 | sub _shiftBoolean { | ||
| 25 | my $xArg = shift @{shift @_}; | ||
| 26 | return defined($xArg) ? $xArg : 0; | ||
| 27 | } | ||
| 28 | |||
| 29 | #---------------------------------------------------------------- | ||
| 30 | |||
| 31 | sub _shiftVisitor { | ||
| 32 | my ($aArgs) = @_; | ||
| 33 | |||
| 34 | #some of the subversion API methods cause a segmentation fault | ||
| 35 | #unless they are passed some sort of visitor, even if that | ||
| 36 | #visitor is only a NOOP | ||
| 37 | |||
| 38 | my $crVisit = shift @$aArgs; | ||
| 39 | return defined($crVisit) ? $crVisit : $NOOP; | ||
| 40 | } | ||
| 41 | |||
| 42 | #================================================================== | ||
| 43 | # MODULE INITIALIZATION | ||
| 44 | #================================================================== | ||
| 45 | |||
| 46 | 1; |