summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4370c2d)
raw | patch | inline | side by side (parent: 4370c2d)
author | Marcus Griep <marcus@griep.us> | |
Fri, 15 Aug 2008 19:53:59 +0000 (15:53 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 16 Aug 2008 09:58:22 +0000 (02:58 -0700) |
This will ensure that the API at large is accessible to nearly
all Perl versions, while only the temp file caching API is tied to
the File::Temp and File::Spec modules being available.
Signed-off-by: Marcus Griep <marcus@griep.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
all Perl versions, while only the temp file caching API is tied to
the File::Temp and File::Spec modules being available.
Signed-off-by: Marcus Griep <marcus@griep.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl/Git.pm | patch | blob | history |
diff --git a/perl/Git.pm b/perl/Git.pm
index 405f68fc391cdae158dde10f7128f4a3b8167860..102e6a4ce3f63ea5754eff581c17df325cc1e073 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
use Error qw(:try);
use Cwd qw(abs_path);
use IPC::Open2 qw(open2);
-use File::Temp ();
-require File::Spec;
use Fcntl qw(SEEK_SET SEEK_CUR);
}
sub _temp_cache {
my ($name) = @_;
+ _verify_require();
+
my $temp_fd = \$TEMP_FILES{$name};
if (defined $$temp_fd and $$temp_fd->opened) {
if ($TEMP_LOCKS{$$temp_fd}) {
$$temp_fd;
}
+sub _verify_require {
+ eval { require File::Temp; require File::Spec; };
+ $@ and throw Error::Simple($@);
+}
+
=item temp_reset ( FILEHANDLE )
Truncates and resets the position of the C<FILEHANDLE>.