GnuPG::Interface 0.33 review

Download
by rbytes.net on

GnuPG::Interface is a Perl interface to GnuPG. SYNOPSIS # A simple example use IO::Handle; use GnuPG::Interface;

License: Perl Artistic License
File size: 37K
Developer: Frank J. Tobin
0 stars award from rbytes.net

GnuPG::Interface is a Perl interface to GnuPG.

SYNOPSIS

# A simple example
use IO::Handle;
use GnuPG::Interface;

# settting up the situation
my $gnupg = GnuPG::Interface->new();
$gnupg->options->hash_init( armor => 1,
homedir => '/home/foobar' );

# Note you can set the recipients even if you aren't encrypting!
$gnupg->options->push_recipients( 'ftobin@cpan.org' );
$gnupg->options->meta_interactive( 0 );

# how we create some handles to interact with GnuPG
my $input = IO::Handle->new();
my $output = IO::Handle->new();
my $handles = GnuPG::Handles->new( stdin => $input,
stdout => $output );

# Now we'll go about encrypting with the options already set
my @plaintext = ( 'foobar' );
my $pid = $gnupg->encrypt( handles => $handles );

# Now we write to the input of GnuPG
print $input @plaintext;
close $input;

# now we read the output
my @ciphertext = ;
close $output;

waitpid $pid, 0;

GnuPG::Interface and its associated modules are designed to provide an object-oriented method for interacting with GnuPG, being able to perform functions such as but not limited to encrypting, signing, decryption, verification, and key-listing parsing.

How Data Member Accessor Methods are Created

Each module in the GnuPG::Interface bundle relies on Class::MethodMaker to generate the get/set methods used to set the object's data members. This is very important to realize. This means that any data member which is a list has special methods assigned to it for pushing, popping, and clearing the list.

Understanding Bidirectional Communication

It is also imperative to realize that this package uses interprocess communication methods similar to those used in IPC::Open3 and "Bidirectional Communication with Another Process" in perlipc, and that users of this package need to understand how to use this method because this package does not abstract these methods for the user greatly. This package is not designed to abstract this away entirely (partly for security purposes), but rather to simply help create 'proper', clean calls to GnuPG, and to implement key-listing parsing. Please see "Bidirectional Communication with Another Process" in perlipc to learn how to deal with these methods.

Using this package to do message processing generally invovlves creating a GnuPG::Interface object, creating a GnuPG::Handles object, setting some options in its options data member, and then calling a method which invokes GnuPG, such as clearsign. One then interacts with with the handles appropriately, as described in "Bidirectional Communication with Another Process" in perlipc.

Requirements:
Perl

GnuPG::Interface 0.33 keywords