diff options
Diffstat (limited to 'lib/Mail/Run/Crypt.pm')
-rw-r--r-- | lib/Mail/Run/Crypt.pm | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/Mail/Run/Crypt.pm b/lib/Mail/Run/Crypt.pm index 2fa1bb8..e3210fd 100644 --- a/lib/Mail/Run/Crypt.pm +++ b/lib/Mail/Run/Crypt.pm @@ -6,22 +6,20 @@ use warnings; use utf8; # Require this version of Perl -# 5.010 for defined-or operator -use 5.010; +use 5.008_001; # Import required modules use Carp; -use Const::Fast; use English '-no_match_vars'; use IPC::Run3; use Mail::GnuPG; use MIME::Entity; # Specify package verson -our $VERSION = '0.04'; +our $VERSION = '0.05'; # Default exit value -const our $DEFAULT_EXIT => 127; +our $DEFAULT_EXIT = 127; ## no critic (ProhibitMagicNumbers) # Oldschool constructor sub new { @@ -36,11 +34,11 @@ sub new { # Default the instance name to the package name if it wasn't given; # runcrypt(1) will pass it in - $self->{name} //= $class; + defined $self->{name} or $self->{name} = $class; # We default to encrypting but not signing - $self->{encrypt} //= 1; - $self->{sign} //= 0; + defined $self->{encrypt} or $self->{encrypt} = 1; + defined $self->{sign} or $self->{sign} = 0; # If signing, we need a key ID and a passphrase if ( $self->{sign} ) { @@ -83,7 +81,14 @@ sub run { } # Return the value of the most recently run command, or 1 otherwise -sub bail { return shift->{exit} // $DEFAULT_EXIT } +sub bail { + my $self = shift; + my $exit = + defined $self->{exit} + ? $self->{exit} + : $DEFAULT_EXIT; + return $exit; +} # Send the message to the address in $ENV{MAILTO} sub _mail { @@ -127,15 +132,13 @@ __END__ mailserver decrypt runcrypt GPG OpenPGP tradename licensable MERCHANTABILITY mailto keyid -=encoding utf8 - =head1 NAME Mail::Run::Crypt - Encrypt and mail output from command runs =head1 VERSION -Version 0.04 +Version 0.05 =head1 DESCRIPTION @@ -273,7 +276,7 @@ L<https://sanctum.geek.nz/arabesque/series/gnu-linux-crypto/> =item * -Perl v5.10.0 or newer +Perl v5.8.1 or newer =item * @@ -281,10 +284,6 @@ L<Carp|Carp> =item * -L<Const::Fast|Const::Fast> - -=item * - L<English|English> =item * |