diff options
Diffstat (limited to 'perl/lib/Nix/Store.pm')
-rw-r--r-- | perl/lib/Nix/Store.pm | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/perl/lib/Nix/Store.pm b/perl/lib/Nix/Store.pm index 2e79c74fe290..191116ee5637 100644 --- a/perl/lib/Nix/Store.pm +++ b/perl/lib/Nix/Store.pm @@ -42,50 +42,50 @@ if ($Nix::Config::useBindings) { use File::Temp; use Fcntl qw/F_SETFD/; - sub hashFile { + *hashFile = sub { my ($algo, $base32, $path) = @_; my $res = backtick("$Nix::Config::binDir/nix-hash", "--flat", $path, "--type", $algo, $base32 ? "--base32" : ()); chomp $res; return $res; - } - - sub hashPath { + }; + + *hashPath = sub { my ($algo, $base32, $path) = @_; my $res = backtick("$Nix::Config::binDir/nix-hash", $path, "--type", $algo, $base32 ? "--base32" : ()); chomp $res; return $res; - } - - sub hashString { + }; + + *hashString = sub { my ($algo, $base32, $s) = @_; my $fh = File::Temp->new(); print $fh $s; my $res = backtick("$Nix::Config::binDir/nix-hash", $fh->filename, "--type", $algo, $base32 ? "--base32" : ()); chomp $res; return $res; - } - - sub addToStore { + }; + + *addToStore = sub { my ($srcPath, $recursive, $algo) = @_; die "not implemented" if $recursive || $algo ne "sha256"; my $res = backtick("$Nix::Config::binDir/nix-store", "--add", $srcPath); chomp $res; return $res; - } - - sub isValidPath { + }; + + *isValidPath = sub { my ($path) = @_; my $res = backtick("$Nix::Config::binDir/nix-store", "--check-validity", "--print-invalid", $path); chomp $res; return $res ne $path; - } - - sub queryPathHash { + }; + + *queryPathHash = sub { my ($path) = @_; my $res = backtick("$Nix::Config::binDir/nix-store", "--query", "--hash", $path); chomp $res; return $res; - } + }; } 1; |