dump#
Write the current Digest::SHA state to a file or STDOUT in text form.
With a filename argument, writes the text produced by getstate to that file, truncating it if it exists. Without an argument, prints the same text to STDOUT. The companion load method reads it back.
Σύνοψη#
$sha->dump("hash.state");
$sha->dump; # to STDOUT
Τι επιστρέφεται#
1 on success (truthy), undef on I/O failure.
Παραδείγματα#
my $sha = Digest::SHA->new(256);
$sha->add("partial");
$sha->dump("checkpoint.state");
## ... later, perhaps in another process ...
my $resumed = Digest::SHA->load("checkpoint.state");
$resumed->add("tail");
print $resumed->hexdigest;
## Debug-dump to the terminal:
$sha->dump;
## Check the return value for I/O errors:
defined $sha->dump("/nonexistent/path/file")
or warn "could not write state";
Οριακές περιπτώσεις#
An unwritable path returns
undefrather than croaking.Called on a non-
Digest::SHAobject, returnsundef.
Διαφορές από το upstream#
Fully compatible with upstream Digest::SHA 6.04.
Δείτε επίσης#
load- counterpart that reads the filedumpproduces.getstate- underlying text-state producer.putstate- text-state ingester.