Subject: | Feature request - more documentation and examples |
Hi,
I'm not exactly sure what to write. I didn't know how to handle return
value of GPG->verify() as documentation says nothing about possible
return values of function. I know, one can study source code of module
and so on-
I think return values of functions would be useful.
I don't expect following lines to be integrated, yet I hope somebody
might find them useful. Terminology and code quality might be a bit off,
but it still should serve as an example and inspiration.
Regards,
Z.
---
verify($text) ~ verifies a signature.
Returns an array of hashes on success, or an empty array in case text is
not signed nor valid (?).
~~~ EXAMPLE ~~~
my $verify = $gpg->verify($text);
my $noArrItems = @$verify;
printf("No. items in array: %i\n", $noArrItems);
for my $hashItem (@$verify)
{
for my $hashKey (keys($hashItem))
{
printf("%s:%s\n", $hashKey, $hashItem->{$hashKey});
}
}
~~~ EXAMPLE ~~~
Show quoted text
--- OUTPUT ---
No. items in array: 1
ok:1
algo:DSA
key_id:B487EE29
key_user:My Self (my_key) <myemail@domain.tld>
sig_date:Wed Jul 20 05:57:31 2011 CEST
--- OUTPUT ---
The similar is for functions GPG->list_keys() and GPG->list_sig() as
they both do return similar structure, array of hashes, The only thing
different here is signature is presented as an array.